• We’re trying to setup Single Sign On using WP OAuth Server but not able to figure out 2 simple things. 1. How to sync User Roles between 2 WP Installations 2. How to redirect users to Admin Dashboard of client site.

    Can anyone quickly help?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Justin Greer

    (@justingreerbbi)

    Hi,

    This is possible by using the but the plugin does not send roles by default. You can add extra data to the “/me” method by using a filter. An example of adding the first name and last name is below. You could easily modify it to send the roles as well.

    
    /**
     * Add first name and last name to return for /oauth/me
     */
    add_filter( 'wo_me_resource_return', 'wo_example_extend_me', 99 );
    function wo_example_extend_me( $data ) {
    
    	// Grab a custom user meta field
    	$first_name = get_user_meta( $data['ID'], 'first_name', true );
    	$last_name  = get_user_meta( $data['ID'], 'last_name', true );
    
    	$data['first_name'] = $first_name;
    	$data['last_name']  = $last_name;
    
    	return $data;
    }

    As for redirecting users to the admin dashboard, it all depends on the client you are using. Are you developing your own or using another plugin?

    Thread Starter zo

    (@zotezo)

    Hi,
    Actually where it needs to add the code?
    Also I have added first name last name but that is not showing in user profile page.

    How to achieve that?

    Thread Starter zo

    (@zotezo)

    yes we are using this https://digits.unitedover.com/ for registration and login..

    Thread Starter zo

    (@zotezo)

    After updating the Single Sign On plugin to version 1.4.6, my second issue is solved.
    Still 2 things are missing
    1. Seems it’s unable to sync First Name and Last Name although your version 1.4.5 says it will.
    2. Most important is user roles.

    Thread Starter zo

    (@zotezo)

    Hi,
    @@justingreerbbi Any update regarding my concern? How to bring first Name, Last name..currently in the site No first name and last name is coming..Please look into the mater..

    Plugin Author Justin Greer

    (@justingreerbbi)

    The code snippet I provided should be added to your theme’s function file on the site that WP OAuth Server is installed. The code snippet should provide the additional info in the API endpoint for /oauth/me

    Thread Starter zo

    (@zotezo)

    Hi,
    >>The code snippet should provide the additional info in the API endpoint for /oauth/me
    Ok thanks for the code.We will add and let you know.

    Now can you please let me know how to add roles here? How to sync user roles between two wordpress easily?

    Thanks,
    Dwaipayan

    Thread Starter zo

    (@zotezo)

    Hi,
    We need to signup users on Main Site with “example1” role as default and when a specific profile form is submitted role should be upgraded to “example2” or “example3” or unchanged.
    When the user travels to Sub-Site via SSO( single sign on), the Main Site role of the user should be synced in Sub-Site.

    Another way to look at it is, if a user’s profile has a field with specific data, then role should be upgraded to “example2” or “example3″the second part remains the same, Role has to sync with Sub-Site.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘quick fixing and help required’ is closed to new replies.