• Resolved ninsan

    (@jennyrigsjo)


    Good afternoon!

    So in the plugin’s settings, under User Roles > [Role Name] > Registration Options, there is the option of automatically disabling new user accounts until they have been approved by an admin. However, this applies not only to users created via the registration form, but also to users added by an admin via wp-admin > Users > Add New. Is there a way to exempt users created by admins from this rule so that their accounts are automatically approved? I’ve searched the documentation for a suitable hook or piece of code, but I haven’t been able to find one.

    Just to be clear, what I am looking to do is to automatically disable user accounts created via the registration form, while at the same time automatically approving users created by logged-in admins via the wp-admin interface.

    Thanks. ??

    /jenny

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @jennyrigsjo

    You can try the following code snippet to approve users when registering in WP Admin > Users.

    // Auto approve a user on registration in WP Admin
    add_action("um_registration_complete","um_120621_wpadmin_approve_register_user");
    function um_120621_wpadmin_approve_register_user( $user_id ){
    
        if( is_admin() ){
            um_fetch_user( $user_id );
    		UM()->user()->approve();
    	}
    }

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    Regards,

    • This reply was modified 3 years, 3 months ago by Champ Camba.
    Thread Starter ninsan

    (@jennyrigsjo)

    @champsupertramp Thank you, worked like a charm! ??

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set only users created via registration form as “pending”?”’ is closed to new replies.