add existing user ad a new user in multisite

i want the ability to reenter existing user into site “b” even that he exist in site “a”

site B is managed by 1 person and A by another, they need the ability to enter a user in a eazy way and the do not know he is already exist in site A.

how can i do it ?

  • Alexander
    • DEV MAN’s Mascot

    Hello @ofir2907,

    This can easily be done with the Add Existing Users plugin:

    https://premium.wpmudev.org/project/add-existing-users/

    All that’s needed is their email address. You can enter multiple email addresses at once, then choose a role. If the user already exists in the Multisite network, they will be added to the blog.

    Let me know how it goes, and if you need any more help with this!

    Best regards, Alexander Rohmann

  • Alexander
    • DEV MAN’s Mascot

    @ofir2907,

    Ok, sorry about that. I probably jumped the gun by recommending that plugin.

    I’ve looked into this further, and unfortunately, this isn’t possible without some custom coding. And it would take quite a bit of doing to implement. Much of this problem has to do with the way WordPress has structured things behind the scene. It’s not the easiest process to hook into.

    I won’t be able to code this for you, but here’s a general idea of the steps needed.

    users-new.php on line 115 – You’d need to hijack this validation somehow, and instead of giving an error, when it finds out the user already exists, you’ll want to add to your new blog.

    Then you can use something like this to add the existing user.

    $role = 'subscriber';
    $user = get_user_by_email( $email);
    add_user_to_blog( $wpdb->blogid, $user->ID, $role);

    And finally, you’ll want to make sure they get through to the standard success message that the user “was created”

    I hope this helps! If you need a developer to do this for you, be sure to checkout our job board: https://premium.wpmudev.org/wpmu-jobs/

    Best regards, Alexander Rohmann

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.