Re: Add phpBB users to custom WordPress groups/roles
Posted: Mon May 07, 2018 1:22 pm
IMPORTANT: after some time, and as ever, i re-think on all what i do, so some other have come out: your posts words above let me think to the fact that the joke maybe work if the user come as logged into phpBB to wordpress, but not work if the user will be added due to a different scenario:
the user isn't logged into phpBB, and come to login first time into WP side.
There is also an error on code.
To fix this, the same code need to be applied also into another function, on same file class.wp.w3all-phpbb.php that is function
public static function w3_check_phpbb_profile_wpnu($username){
inside there is this code:
actually it need to be changed also BECAUSE IT IS WRONG, into this (that is +- the same as on private static function verify_phpbb_credentials(){), so
and apply modifications in the way like above explained. Note: here the array is $phpbb_user[0]->group_name and not $phpbb_user_session[0]->group_name
This part will be updated as soon on repo, and the file patched because containing wrong code and was not working properly. After the error, any user were added as subscriber in WP when coming to login WP first time.
1.8.9 will be released as soon, containing all 1.8.8 fixes.
[EDITED]
patch class.wp.w3all-phpbb.php into function
public static function w3_check_phpbb_profile_wpnu($username){
to fix code about new phpBB user addition in wordpress, when login wordpress first time
1.8.9 has been released.
the user isn't logged into phpBB, and come to login first time into WP side.
There is also an error on code.
To fix this, the same code need to be applied also into another function, on same file class.wp.w3all-phpbb.php that is function
public static function w3_check_phpbb_profile_wpnu($username){
inside there is this code:
Code: Select all
if ( $phpbb_user[0]->group_name == 'ADMINISTRATORS' ){
$role = 'administrator';
$u_role = 'a:1:{s:13:"administrator";b:1;}';
} elseif ( $phpbb_user[0]->group_name == 'GLOBAL_MODERATORS' ){
$role = 'editor';
$u_role = 'a:1:{s:6:"editor";b:1;}';
} else {
$role = 'subscriber'; // for all others phpBB Groups default to WP subscriber
$u_role = 'a:1:{s:10:"subscriber";b:1;}';
}
Code: Select all
if ( $phpbb_user[0]->group_name == 'ADMINISTRATORS' ){
$role = 'administrator';
} elseif ( $phpbb_user[0]->group_name == 'GLOBAL_MODERATORS' ){
$role = 'editor';
} else { $role = 'subscriber'; } // for all others phpBB Groups default to WP subscriber
This part will be updated as soon on repo, and the file patched because containing wrong code and was not working properly. After the error, any user were added as subscriber in WP when coming to login WP first time.
1.8.9 will be released as soon, containing all 1.8.8 fixes.
[EDITED]
patch class.wp.w3all-phpbb.php into function
public static function w3_check_phpbb_profile_wpnu($username){
to fix code about new phpBB user addition in wordpress, when login wordpress first time
1.8.9 has been released.