Support » Plugin: Restrict Content » [Plugin: Restrict Content] Using this plugin with edited role names

  • Hi,

    I’ve changed the names of the contributor and subscriber roles using this code in my theme function.php file:

    function change_role_name() {
    global $wp_roles;

    if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

    //You can list all currently available roles like this…
    //$roles = $wp_roles->get_names();

    //You can replace “administrator” with any other role “editor”, “author”, “contributor” or “subscriber”…
    $wp_roles->roles[‘subscriber’][‘name’] = ‘Non-Resident’;
    $wp_roles->role_names[‘subscriber’] = ‘Non-Resident’;
    $wp_roles->roles[‘contributor’][‘name’] = ‘Property Owner / Resident’;
    $wp_roles->role_names[‘contributor’] = ‘Property Owner / Resident’;

    add_action(‘init’, ‘change_role_name’);

    I can make this plugin work fine with this code with one exception. When selecting the restriction access in the plugin’s dialog box on each post, the drop down menu still shows contributor and subscriber. I would like it to show my new role names instead. I know where the array is for the drop down selection menu and that will change the names in the drop down, but the restriction then fails to work. I’m sure I need to change the role names in the other plugin files, but I’m not sure what changes need to be made. Can anyone help?

    Basically, I need this plugin to allow me to select the custom role names I’m using (when creating new posts)and still function properly.


Viewing 1 replies (of 1 total)
  • Plugin Author Pippin Williamson


    You will need to change the names in several different places. You’re on the right track by changing them in the meta box, but you also need to change them in the display-functions.php file.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Restrict Content] Using this plugin with edited role names’ is closed to new replies.