Support » Fixing WordPress » Change new user role

  • Hi champions
    I am trying to change new user role from contributor, to slug, member.

    But i have this code, and its not woo commerce. Its a wordprees install.
    Can you help?

    /** Here changing 'customer' role to 'subscriber'.**/
    add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);
     
    function wc_assign_custom_role($args) {
      $args['role'] = 'member';
      
      return $args;
    }
    • This topic was modified 3 months, 2 weeks ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Moved to Fixing WordPress, this is not an Developing with WordPress topic.

    Please ask plugin specific questions in that plugin’s dedicated sub-forum instead.

    https://wordpress.org/support/plugin/woocommerce/#new-post

    Thread Starter kingcooper

    (@kingcooper)

    Hi Champions
    OK, I’ve changed tack a bit. I want this code, with an addition. I want it to add another role too.
    So can anyone take this snippit of code and add to it? The extra user role i want assigned in my website is wsdesk_user.
    Can anyone help?
    Cheers in advance.

    /** Here changing 'customer' role to 'subscriber'.**/
    add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);
     
    function wc_assign_custom_role($args) {
      $args['role'] = 'member';
      
      return $args;
    }
    Thread Starter kingcooper

    (@kingcooper)

    Will this do it:

    /** Here changing 'customer' role to 'subscriber'.**/
    add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);
     
    function wc_assign_custom_role($args) {
      $args['role'] = 'member' 'wsdesk_user';
      
      return $args;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.