Page 1 of 2
Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 11:04 am
by getty
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!
Re: Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 2:39 pm
by axew3
open file
/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' );
change into
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' );
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.
Re: Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 3:26 pm
by getty
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:
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;
}
}
It works but i'm not sure it's securely.
Re: Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 8:08 pm
by getty
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).
Re: Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 9:08 pm
by axew3
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).
Re: Redirect to phpbb login/sign up page
Posted: Sun Sep 09, 2018 10:54 pm
by getty
axew3 wrote: ↑Sun Sep 09, 2018 9:08 pm
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).
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).