Skip to content

Instantly share code, notes, and snippets.

@ideadude
Created December 26, 2017 22:01
Show Gist options
  • Save ideadude/acb33e74c931b8150de5e1d771b8adec to your computer and use it in GitHub Desktop.
Save ideadude/acb33e74c931b8150de5e1d771b8adec to your computer and use it in GitHub Desktop.
Set a user's bbpress role when importing using the Import Users From CSV Plugin
/*
Add this code to a custom plugin.
*/
function bbpress_role_is_iu_post_user_import( $user_id ) {
//if you had a column in your import with the role in it, you can grab it from user meta instead of setting it here
$new_role_forum_role='bbp_participant';
bbp_set_user_role( $user_id, $new_role_forum_role );
}
add_action( 'is_iu_post_user_import', 'bbpress_role_is_iu_post_user_import');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment