WordPress.org

Ready to get started?Download WordPress

Forums

Restrict Content
Using this plugin with edited role names (2 posts)

  1. ElTeniente
    Member
    Posted 2 years ago #

    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();
    //print_r($roles);

    //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.

    Thanks

    http://wordpress.org/extend/plugins/restrict-content/

  2. Pippin Williamson
    Pippin's Plugins and Plugin Reviewer
    Plugin Author

    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic