So, i've take a deep look into.
Then resuming there is this problem:
when/if, an user go to register into WP using the WP members page/form,
instead of do a login, so he would be added automatically and logged into WP,
when there is an existent username/email existent into phpBB:
using the wordpress default the user is correctly informed that the account has not been created because an email/username already exist into phpBB.
using the WP members registration form, the user instead is redirected to the wp members page that, even if the user has not been added due to the above, nor an email has been sent, the WP members notice say:
Congratulations! Your registration was successful.
You may now log in using the password that was emailed to you.
WP members bypass any default and go for his own way. The code flow assume that the user has been created and it display the wrong result.
From where it come from?
The error is of the WP member in this sense:
open up the file
/wp-content/plugins/wp-members/includes/api/api-users.php
lines 780/781
Code: Select all
// Inserts to wp_users table.
$user_id = wp_insert_user( $new_user_fields );
the following code simply do not care if the
wp_insert_user fail or not and follow with
Code: Select all
do_action( 'wpmem_register_redirect', $wpmem->user->post_data, $user_id );
But the user has not been created because the wp_w3all.php function
w3all_wp_pre_insert_user_data()
do this
Code: Select all
if(empty($updating_user_id))
{
if(is_array($userdata) && !empty($userdata['user_email'])){
$u = WP_w3all_phpbb::ck_phpbb_user($userdata['user_login'], $userdata['user_email']);
} elseif(is_object($userdata) && !empty($userdata->user_email)){
$u = WP_w3all_phpbb::ck_phpbb_user($userdata->user_login, $userdata->user_email);
}
if( !empty($u) ){
$data = '';
$error = new WP_Error();
$error->add( 'invalid_email', 'Error: Username or email address exist into our forum.' );
}
}
if an email or username is found in phpBB it empty the var
$data = '';
so, infact, into the file
/wp-content/plugins/wp-members/includes/api/api-users.php
if you put this code
echo var_dump($user_id);exit;
just after
Code: Select all
$user_id = wp_insert_user( $new_user_fields );
you'll see this:
Code: Select all
object(WP_Error)#697 (3) { ["errors"]=> array(1) { ["empty_data"]=> array(1) { [0]=> string(36) "Not enough data to create this user." } } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } }
The user has not been created, but WP members do not care of nothing, nor about that there is not an userID, but instead there is an error, and follow with his hooks/filters and redirect with a wrong message, that do not rely into WP native errors, that's why you see the correct behavior using WP native registration form and NOT if using the WP members registration form.
Consider that doing this directly into the
api-users.php file as test, so passing 0 as result, still follow answering that the user has been created!
Code: Select all
$wpmem->user->post_data = $user_id = 0;
do_action( 'wpmem_register_redirect', $wpmem->user->post_data, $user_id );
I will maybe follow with some solution.