User Roles based on URL for Social Login

edited June 2015 in WordPress
Hi,
i m using two different registration forms on my site, the registered users have two different roles named "subscriber" and "author".
but the problem is that the social login plugin by default registered user from both the forms as "subscriber".
how can i change the user role on one form to registered user as a "author"??
any suggestions?
although is the documentation of plugin there is column that is telling how to change the user by default role but i have two different forms?
here is the link of that column: https://docs.oneall.com/plugins/guide/social-login-wordpress/#3.5
thanx in advance

Best Answer

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Answer ✓
    Hi Moaz,

    could you please try to add the following code to the functions.php file of your WordPress theme.

    //Set a custom role for a new user function oa_social_login_set_new_user_role ($user_role) { $current_url = oa_social_login_get_current_url(): // Employer if (strpos ($current_url, 'employer') !== false) { return 'employer'; } return $user_role; } //This filter is applied to the roles of new users add_filter('oa_social_login_filter_new_user_role', 'oa_social_login_set_new_user_role');

    This should set the role "employer" for users that register here:
    http://agileanjobs.com/employer-panel/employer-registration/

    Welcome!

    Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

    Please click on the link below to connect to the forum with your OneAll account.