Home / Archive / MemberPress: Allow a User Role to Access the Admin Area
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Allow a User Role to Access the Admin Area

By default, only users with the Administrator user role will be allowed to access the MemberPress options and related data in the backend of your website (Dashboard).

This code snippet provides access to the MemberPress in your dashboard for any role that is higher in hierarchy than the Subscriber role. For example, these roles could be Editor or Author.

Note: This code will not work with the Subscriber or subscriber-based cloned user roles.

The code example below provides access for all users with the Editor user role.

Code Preview
php
<?php
// allow Editors to access Memberpress
function add_memberpress(){
$role = get_role('editor');
$role->add_cap('remove_users');
}
add_action('admin_init','add_memberpress');

Comments

Add a Comment