Social Login with WPMU (Multi-site)

edited March 2016 in WordPress
I am trying to implement the social login system on a multi-site setup and I need the users who choose to login through this plugin to be granted "subscriber" access to the site they tried to register on. Is there a setting that I am missing that should allow this to work?

Best Answer

  • Reuben_BrownReuben_BrownMember
    Answer ✓
    I had to correct the line since the $user object was not initialized yet:
    //connect user to blog that they registered with
    $user = new WP_User( $user_id );
    update_user_meta($user_id, $wpdb->prefix.'user_level', 0);
    $user->add_cap('subscriber');

Answers

  • I have written a fix for this already and it is just a total of 4 lines of code to add to the communication.php file. Just below the points where a user is either updated or created and their new social meta is saved you add:

    //connect user to blog that they registered with
    update_user_meta($user_id, $wpdb->prefix.'user_level', 0);
    $user->add_cap('subscriber');

    This is just after the 2 instances of:
    delete_metadata ('user', null, 'oa_social_login_user_token', $user_token, true);
    update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
    update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
  • I forgot to include that I also had to initialize:
    global $wpdb;

    at the top of the function oa_social_login_callback ().
Sign In or Register to comment.