Open yomisimie opened 7 years ago
Hi @yomisimie!
Thank you for reporting this issue. Would you be able to provide me steps to re-create the issue?
@rebeccahum sorry, been away for a while.
The process is: I insert my users manually in PHP and i have to set a user_login
so I am using email_post-id
format. The user_login
is not sanitized like the user_nicename
so it still has special characters (the wp function wp_insert_user doesn't remove special characters: @
,.
) so when your plugin checks for existing users it checks for user_login
and compares it to user_nicename
, the last one being sanitized it doesn't match up.
My script:
$username = $_POST['user_email']."_".$id;
$random_password = wp_generate_password( 12, false );
$userdata = array(
'user_login' => $username,
'user_email' => $_POST['user_email'],
'user_pass' => $random_password,
'first_name' => $_POST['first_name'],
'last_name' => $_POST['last_name'],
);
$user = wp_insert_user($userdata);
The error comes from here
@rebeccahum any updates on this issue?
We should do some testing but this does sound like a bug we need to fix.
Hi @yomisimie, sorry for the delay! I'm just looking into things right now and trying to re-create your issue. With your script, how is that done? Via a custom registration form? And are you able to elaborate a little more on the deleting part of the old users?
Hi @yomisimie, I have tried recreating the issue with the latest commit of the master branch of this repository, but I haven't managed to. What I have done is:
No issues arose from these steps. Does the issue still exists for you? Can you point out whether I did something wrong?
Maybe fixed by #369.
I noticed this issue if the
user_login
is different fromuser_nicename
. This occurs in the main fileco-authors-plus.php
on line815
:if ( $append ) { $existing_coauthors = wp_list_pluck( get_coauthors( $post_id ), 'user_login' ); } else { $existing_coauthors = array(); }
The problem is that myuser_login
is the same asuser_email
anduser_nicename
removes the@
and.
from the email address making it very different from theuser_login
. Also, if anywhere in the plugin it checks foruser_nicename
shouldn't this check for it too?