Auto join group based on role
-
Hello,
I have users with the role of Vendor, based on WCVendors and WooCommerce.
Once the person submits application to be a Vendor and it is accepted, the role of Vendor is added to them.I have a Group for Vendors. I need a way for them to be added to the Vendors Group once the role is added.
This code to auto add new members to a group seems the likely place to start but I don’t know how to do it. Would someone PLEASE help me with this?
//Automatically add new users to a group function automatic_group_membership( $user_id ) { if( !$user_id ) return false; groups_accept_invite( $user_id, 2 ); } add_action( 'user_register', 'automatic_group_membership' );
To a newbie like me seems like this can be altered to $role , correct?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.