• Hi,
    I have assigned “student” as the default user role for any new user who registers. I have changed the default role in wordpress general settings also to “Student”.
    But it is still assigning “Customer” role to the new user. Everytime, I have to change the user role to “Student” whenever a new user registers.
    Can you please help me?
    Regards
    Saxena

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    If you use ‘WooCommerce’, then it overwrites WordPress default role value for new registered user with a ‘customer’ one.

    Thread Starter S Saxena

    (@witage)

    Hi Vladimir,
    I am using WooCommerce.
    Is there any solution to this?
    I have thought of adding this script in my active theme’s function.php. Please let me know if this will work and will not have any conflict with your plugin.

    /**
    * Replace ‘customer’ role (WooCommerce use by default) with your own one.
    **/
    add_filter(‘woocommerce_new_customer_data’, ‘wc_assign_custom_role’, 10, 1);

    function wc_assign_custom_role($args) {
    $args[‘role’] = ‘subscriber’;

    return $args;
    }
    Replace ‘subscriber’ with role ID of your choice

    Regards
    Saxena

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not accepting default user role’ is closed to new replies.