Hello!
Could you please help me to make user be redirected to the phpbb login/sign up page when they try to log in/ sign up in the wordpress side?
For me forum is the mainest part of the web site, so i want to use it's auth pages.
Thank you!
Redirect to phpbb login/sign up page
- axew3
- w3all User
- Posts: 2883
- Joined: Fri Jan 22, 2016 5:15 pm
- Location: Italy
- Contact:
Re: Redirect to phpbb login/sign up page
open file
/wptests/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php
search for this code:
change into
this code is here from very firsts versions of the plugin, i have not the time now to check the code, but should be no reason why it should not work.
If any problem in case let know (and even if ok, so i know that i do not need to take a re-look of it!).
Unfortunately when you'll update the plugin you'll loose this changes and you'll need to re-apply:
so this will be added as option as soon into plugin Admin config page because seem to be useful.
/wptests/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php
search for this code:
Code: Select all
// this affect the lost password url on WP
// comment out the follow 'add_filter' line to set lost password link point to phpbb lost password page
//add_filter( 'lostpassword_url', 'phpbb_reset_pass_url', 10, 2 );
// this affect the register url on WP
// comment out the follow 'add_filter' line to set register link point to phpbb register
//add_filter( 'register_url', 'phpbb_register_url' );
Code: Select all
// this affect the lost password url on WP
// comment out the follow 'add_filter' line to set lost password link point to phpbb lost password page
add_filter( 'lostpassword_url', 'phpbb_reset_pass_url', 10, 2 );
// this affect the register url on WP
// comment out the follow 'add_filter' line to set register link point to phpbb register
add_filter( 'register_url', 'phpbb_register_url' );
If any problem in case let know (and even if ok, so i know that i do not need to take a re-look of it!).
Unfortunately when you'll update the plugin you'll loose this changes and you'll need to re-apply:
so this will be added as option as soon into plugin Admin config page because seem to be useful.
-
- User w
- Posts: 5
- Joined: Sun Sep 09, 2018 11:00 am
Re: Redirect to phpbb login/sign up page
Seems it works fine, thank you!
But i need to redirect to phpbb login page as well. I'm bad in coding so could you tell me whether my soulution is ok?
I added this:
It works but i'm not sure it's securely.
But i need to redirect to phpbb login page as well. I'm bad in coding so could you tell me whether my soulution is ok?
I added this:
Code: Select all
add_filter( 'login_url', 'phpbb_auth_url', 10, 2 );
function phpbb_auth_url( $login_url, $redirect ) {
global $w3all_url_to_cms, $phpbb_on_template_iframe, $wp_w3all_forum_folder_wp;
if( $phpbb_on_template_iframe == 1 ){
$wp_w3all_forum_folder_wp = "index.php/" . $wp_w3all_forum_folder_wp;
$redirect = $wp_w3all_forum_folder_wp . '/?mode=login';
return $redirect;
} else { // lost pass no iframe
$redirect = $w3all_url_to_cms . '/ucp.php?mode=login';
return $redirect;
}
}
-
- User w
- Posts: 5
- Joined: Sun Sep 09, 2018 11:00 am
Re: Redirect to phpbb login/sign up page
Found the problem: if i try to sign in using widget, i'm redirected to forum as well (but want to stay on wp site).
- axew3
- w3all User
- Posts: 2883
- Joined: Fri Jan 22, 2016 5:15 pm
- Location: Italy
- Contact:
Re: Redirect to phpbb login/sign up page
The code is ok, and the hook about login suggested by you will be added also as option, but it is not clear to me now when you say
Found the problem: if i try to sign in using widget, i'm redirected to forum as well (but want to stay on wp site).
-
- User w
- Posts: 5
- Joined: Sun Sep 09, 2018 11:00 am
Re: Redirect to phpbb login/sign up page
Step by step:
1. Add the login-hook i wrote above.
2. Go to WP web-site.
3. In the widget (w3all Login) type username and password.
4. Click Sign in.
Result:
I'm redirected to phpbb login page (/ucp.php?mode=login) and see the error "Tried to redirect to potentially insecure url.". Indeed if i go back to WP web-site, i'm logged in (so authorization goes correctly).