Problem with autologin from WP to phpBB

WP_w3all phpBB code with others external plugins
rojo

Problem with autologin from WP to phpBB

Post by rojo »

Hi there!

Im a new user of your plugin and i think is awesome!

I installed it and everything seems to work without problem except the autologin from WP to phpBB:
~ 60 users transfered. OK
Users can login on phpBB and their session appears on WP. OK
Users can logout on phpBB and their session dissapears on WP. OK
Users can login on WP and their session appears on phpBB. KO
Users can logout on WP and theis session dissapears on phpBB. OK
New user created on WP is replicated to phpBB. OK
Deleted user on WP is disabled on phpBB. OK
Updated profile on WP user is replicated to phpBB user. OK

When i login on wordpress this message appears on the error.log (the wp-login process runs fine):

mod_fcgid: stderr: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_w3all_phpbb_login' not found or invalid function name in .../web/wp-includes/plugin.php on line 524

I tried to perform some debug on file .../web/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php to try to understand whats happening with the action attached to wp_login that executes the wp_w3all_phpbb_login without success, im not a proeficient wordpress user but i understand php and i cant find why this is failing but another similar actions attached for example to wp_logout dont.

I dont have any special plugin installed on wordpress, bbpress and few SEO plugins, nothing related with the login...

My WP version: WordPress 4.6.4

Any help will be very appreciated!

Thank you!

User avatar
axew3
w3all User
w3all User
Posts: 2227
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Problem with autologin from WP to phpBB

Post by axew3 »

hello, since the only one point the hook is called inside a function (maybe it is not a common way!?) i think the solution is so to call the function in directly. Think should be better to patch it in this way in effect:

open wp_w3all.php file and inside

Code: Select all

function wp_check_password($password, $hash, $user_id = '') {
+- at line 498 you'll find this code:

Code: Select all

     if ($check === true){
       add_action('wp_login', 'wp_w3all_phpbb_login', 10, 2);
     }
change it calling the function directly:

Code: Select all

     if ($check === true){
     	$phpBB_user_session_set = WP_w3all_phpbb::phpBB_user_session_set_res($wpu); 
      //add_action('wp_login', 'wp_w3all_phpbb_login', 10, 2);
     }
that maybe is the correct way.

the file wp_w3all.php has been just patched to call into correct way the wp_w3all_phpbb_login() function.
download and replace the single wp_w3all.php file patched on repository (or re-download plugin):
https://plugins.trac.wordpress.org/brow ... tion/trunk
The code has modified in favor of this:

Code: Select all

     if ($check === true){
     	if($wpu){
     	  $phpBB_user_session_set = WP_w3all_phpbb::phpBB_user_session_set_res($wpu); 
      } else {
           add_action('wp_login', 'wp_w3all_phpbb_login', 10, 2);
        }
     }
maybe redundant, but sure.
p.s
Users can login on WP and their session appears on phpBB. KO
ko mean not work or you have wrongly invert ok?

p.s thank for appreciation, next ajax improvements for iframe mode are coming. These are very cool additions ;)

rojo
Posts: 1
Joined: Fri Apr 14, 2017 4:26 pm

Re: Problem with autologin from WP to phpBB

Post by rojo »

Hello!

Thank you for the quick response!

The KO is intentional, that was the part that didnt work, on next reports i will use FAIL :P

I will try the new code you provided ASAP but is strange the behaviour wordpress have here, also the error message dont make sense, the php is valid and the action send the parameters well... but as you said maybe wordpress dont like it for any obscure reason.

Im using your plugin to migrate from bbpress to phpBB, is great for acomplish all the user migration and integration, i implemented some things on it that i will need to perform the migration of forums/threads/replys without dying like:
[*]Keep user_id between WP and phpBB. to be able to track all the WP objects asigned to user_id to the same user_id on phpBB.
[*]phpBB user_id base. To create all user_ids from that base onwards.
[*]phpBB default user language. To specify what language you will set on the phpBB users by default.
[*]phpBB default user TimeZone. To specify what timezone you will set on the phpBB users by default.

I implemented all this options on the wp_w3all_users_to_phpbb.php so far but im implementing it on the rest of the plugin to have the same behaviour when the user is created on WP and replicated to phpBB. It's not implementend so flawlessly but is funcional!

Thank you again, i will let you know when i try the patches.

Post Reply