• Resolved iamarogue

    (@iamarogue)


    Hi there, I looked at this documentation: https://getawesomesupport.com/question/users-get-you-do-not-have-the-capacity-to-open-a-new-ticket/

    I don’t want the default role of all users to be Support User, since I have a forum and use events registration on my site, so I’d prefer all my users to simply have the Subscriber role. I have updated the Subscriber role to have the correct permissions, and then I tested out a new user registering to submit a ticket.

    For some reason, the new user I just created had no role. I imagine somewhere in Awesome Support’s code, it’s trying to assign it the Support User role, but I used User Role Editor to actually delete that role since I was cleaning house. Is there some snippet I can use to change the automatically assigned role for new users from Support User to Subscriber?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    There is a hook available after the user has been added to the database that you can use to modify the user data:
    do_action( ‘wpas_insert_user_after’, $user_id, $args );

    Alternatively, you can search for this line in functions-user.php
    ‘role’ => ‘wpas_user’
    and change the role name directly in the AS code. You’ll just have to remember to change it every time you do an upgrade.

    Thread Starter iamarogue

    (@iamarogue)

    Holy crap, I wrote some code, and it worked! Must have been a fluke.

    add_filter('wpas_insert_user_after', 'nexus_subscriber');
    
    function nexus_subscriber($user_id) {
        $new_role = 'subscriber';
    
        $result = wp_update_user(array('ID'=>$user_id, 'role'=>$new_role));
    
    }
    Plugin Author awesomesupport

    (@awesomesupport)

    Or maybe you’re just more talented than you give yourself credit for!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Default role for new users registering through this plugin’ is closed to new replies.