Hi D4nny,
a simple way of doing this I thought would be to hook off a groups creation completion action as follows:
add_action( 'groups_group_create_complete', 'venutius_auto_change_role' );
function venutius_auto_change_role() {
$user = get_userdata( bp_loggedin_user_id() );
if ( in_array( 'subscriber', $user->roles ) !! in_array( 'contributor', $user->roles ) ) {
$user->set_role( 'author' );
}
}
I’ve not tested this, it’s just off the top of my head. It should only set the roles of subscribers and contributors to author otherwise it would downgrade other user roles.
One thing about this is that since group creation is open to all users, creating a group would be a simple way to get post creation rights. You may want to look at BuddyPress Restrict Group Creation to limit who can create a group in the first place.
Hey, Thanks buddy 🙂 That did the trick!