[Support request] WordPress Default User Role

Home Forums Support [Support request] WordPress Default User Role

Home Forums Support WordPress Default User Role

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1593056
    chris

    Hi,

    I have added a function to snippets, to hopefully change woomcerce’s defualt user role. Users when loggd in cant submit listings, they have to be an “Author” and woomcerce is by default giving the role “customer”

    This is the snippet i have added to the site, and still nothing.

    function my_new_customer_data($new_customer_data){
    $new_customer_data[‘role’] = ‘Author’;
    return $new_customer_data;
    }
    add_filter( ‘woocommerce_new_customer_data’, ‘my_new_customer_data’);

    Any ideas?

    #1593090
    David
    Staff
    Customer Support

    Hi there,

    try:

    add_filter('woocommerce_new_customer_data', 'woo_assign_default_role', 10, 1);
    function woo_assign_default_role($args) {
      $args['role'] = 'author';
      return $args;
    }
    #1595458
    chris

    Hi, still not working. New users being registered as customer still.

    #1595949
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This is probably something you should ask WooCommerce support, as it isn’t related to the theme functionality.

    After a quick look, the function that David provided looks like it should work. WooCommerce support should be able to tell you why it wouldn’t work in your case.

    #1597366
    chris

    Fired them a message. Could it be the fact im running the code through a plugin? if i was to add the code to the child themes functions.php would the code be any different? thanks

    #1597410
    David
    Staff
    Customer Support

    It shouldn’t really matter how that code is added. You can of course try testing that by adding it to a Child Themes Functions.php.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.