by axew3 » Sun Apr 27, 2025 9:58 am
So, standing on latest fixes and my tests with Ultimate member login when an user exist into phpBB but not still in WP:
the last added function into the wp_w3all.php file that hook into
authenticate
Code: Select all
add_filter( 'authenticate', 'wp_w3all_login_existent_phpbb_fix', 5, 3 );
so the function
wp_w3all_login_existent_phpbb_fix
should be like this, to be compatible with UM login/registration flow:
Code: Select all
function wp_w3all_login_existent_phpbb_fix($user, $username, $password){
if(!empty($username) && !empty($password)){
WP_w3all_phpbb::w3_check_phpbb_profile_wpnu($username);
$eu = is_email($username) ? 'email' : 'login';
$u = get_user_by($eu, $username); # maybe a direct query should be necessary?
if(!empty($u))
{
$user = $u; # Good for all
# Good for UM: if the user has been created by 'w3_check_phpbb_profile_wpnu', activate the user on Ultimate Member
if(defined('um_plugin') && defined('WPUSERCREATED')){ # create the record 'um_member_directory'_data into wp_usermeta tab
$result = UM()->common()->users()->approve($u->ID); # activating the user x UM when a new user has been created onlogin because existent into phpBB
}
}
}
# return the user object, if the user has been created by 'w3_check_phpbb_profile_wpnu'
return $user;
}
This cause the user insertion onlogin into WP via a front end page where there is the UM login form, if the user exist into phpBB: firing the
authenticate before UM, adding him to WP via
w3_check_phpbb_profile_wpnu then approving into UM.
So, standing on latest fixes and my tests with Ultimate member login when an user exist into phpBB but not still in WP:
the last added function into the wp_w3all.php file that hook into [i]authenticate[/i]
[code]add_filter( 'authenticate', 'wp_w3all_login_existent_phpbb_fix', 5, 3 );[/code]
so the function
[i][b]wp_w3all_login_existent_phpbb_fix[/b][/i]
should be like this, to be compatible with UM login/registration flow:
[code] function wp_w3all_login_existent_phpbb_fix($user, $username, $password){
if(!empty($username) && !empty($password)){
WP_w3all_phpbb::w3_check_phpbb_profile_wpnu($username);
$eu = is_email($username) ? 'email' : 'login';
$u = get_user_by($eu, $username); # maybe a direct query should be necessary?
if(!empty($u))
{
$user = $u; # Good for all
# Good for UM: if the user has been created by 'w3_check_phpbb_profile_wpnu', activate the user on Ultimate Member
if(defined('um_plugin') && defined('WPUSERCREATED')){ # create the record 'um_member_directory'_data into wp_usermeta tab
$result = UM()->common()->users()->approve($u->ID); # activating the user x UM when a new user has been created onlogin because existent into phpBB
}
}
}
# return the user object, if the user has been created by 'w3_check_phpbb_profile_wpnu'
return $user;
}[/code]
This cause the user insertion onlogin into WP via a front end page where there is the UM login form, if the user exist into phpBB: firing the [i][b]authenticate[/b][/i] before UM, adding him to WP via [i]w3_check_phpbb_profile_wpnu[/i] then approving into UM.