Force a default custom capability at user creation

Hi, I’ve been struggling with this for a while. I can’t seem to pass a custom capability using this hook. It works fine for the Role but not for the ccap. I’m approaching this wrong. Any help would be appreciated.

/* Forces the default role of a new user to be set to "S2Member Level1" instead of "Subscriber" */
add_filter("ws_plugin__s2member_force_default_role", "default_role",10,1);
function default_role($role){
	$return = 's2member_level1';
	$user = wp_get_current_user();
	return $return;


We found a workaround which meets the requirements of our business needs. We used the plugin User Role Editor and changed the capabilities attached under each s2member roles to ensure the higher levels do not see the lower levels.

Thought it would be nice to share if anyone is ever faced with a similar challenge. No coding involved :wink:


Hi Mik.

Thanks for sharing your solution, glad you found something that works best for you.

Yes, you can customize the roles, even s2Member’s. When you do, you need to lock them so they don’t get reset on update, though. See:

If you have s2Member Pro and are using the registration pro-form, you can add ccaps there directly.