psudo admin custom user role cant access member pages


I am using membership 2 pro and created a few pages for members. I also have a user custom admin user role called Sub Admin defined as follows:

$admin = get_role('administrator');
			'Sub Administrator',
		$wp_roles->remove_cap( 'sub_admin', 'activate_plugins');
		$wp_roles->remove_cap( 'sub_admin', 'install_plugins');
		$wp_roles->remove_cap( 'sub_admin', 'update_plugins');
		$wp_roles->remove_cap( 'sub_admin', 'edit_plugins');
		$wp_roles->remove_cap( 'sub_admin', 'delete_plugins');
		$wp_roles->remove_cap( 'sub_admin', 'switch_themes');
		$wp_roles->remove_cap( 'sub_admin', 'edit_themes');
		$wp_roles->remove_cap( 'sub_admin', 'install_themes');
		$wp_roles->remove_cap( 'sub_admin', 'update_themes');

When I go to Membership->members this user shows up as admin so I cant assign him any permissions but when the user logs in, he cant access the member pages.

I have several standard user roles, and they all allow me to set permissions for the user without any problem. Its just this "sub admin" role that is having issues.

Please help me fix this issue.

  • Vinod Dalvi
    • WP Unicorn

    Hi @Hagai,

    I hope you are well today and thank you for your question.

    I have tested it on my test site using the provided code in the small developed plugin attached to this reply and found the user created using this role is not displayed as an admin and can access the members pages as shown in the attached screenshots.

    Could you please try creating the 'Sub Administrator' user role using the attached plugin and creating a new user using that user role?

    Also would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    Kind Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.