Change WordPress user roles and capabilities Forums How to or FAQ Change manage option capability

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5565
    marketingasb
    Participant

    HI Vladimir,

    I have a question currently I am using a table generator plugin, I want to allow users with the editor role to view this plugin menu on wp-admin.

    I understand manage_options capability ONLY Allows certain role to edit this plugin menu

    Hence, this is what I did on the plugin code .

    class WPTG_Table_Generator {
    public function __construct() {
    $this -> add_roles_on_plugin_activation();
    }

    public function add_roles_on_plugin_activation() {
    add_role(‘editor’, ‘Editor’, array( ‘read’ => true, ‘edit_posts’
    => true ));
    }
    }

    Plugin’s index.php

    require_once plugin_dir_path( __FILE__ ) . ‘inc/class-wptg-table-generator.php’;

    function wptg_run_table_generator() {
    $plugin_instance = new WPTG_Table_Generator(‘1.3.0’);
    register_activation_hook( __FILE__, array($plugin_instance, ‘initialize’));
    register_uninstall_hook( __FILE__, array(‘WPTG_Table_Generator’, ‘rollback’) );
    }
    I still cant get it to work.

    This is what I am suppose to see. http://prntscr.com/mw8kue

    However, I can’t see it when I access wp admin as an editor.

    Please do advise me, thank you.

    #5566
    Vladimir
    Keymaster

    Hi,

    Share this TG plugin copy with support [at-sign] role-editor.com
    I will look at its code to answer you, what is possible to do.

    2nd, alternative way, is to grant ‘manage_options’ to editor role, but use Admin menu access add-on to block admin menu items (like ‘Settings’, etc.), which are not needed to ‘editor’ role.

    #5567
    marketingasb
    Participant

    HI Vladimir,

    I don’t quite get you.

    How do I grant manage_option this capability?

    “Share this TG plugin copy with support [at-sign] role-editor.com”

    And I don’t understand what does this mean? You mean you want me to share the source code of the plugin is it?

    Thank you.

    #5568
    Vladimir
    Keymaster

    You can go to “Users->User Role Editor”, select “editor” role and turn ON the “manage_options” checkbox for it. Yes, editor role will get access to the many menu items, including “Settings”. But you can block other menu items with “Admin menu access” add-on.

    Yes, I meant that you can share .zip of TG plugin source code with me via DropBox or similar service. I use such code for the investigation purpose and install locally only.

    #5569
    marketingasb
    Participant

    Hi Vladimir ,

    Thanks for the Reply.

    I think I found a solution. As long as add_menu_page has a manage_options parameter, we can go for each individual user role and tick on manage_options and that particular role will be added inside manage_options.

    Is that correct?

    Thank you.

    #5570
    Vladimir
    Keymaster

    More correct to say:
    “role with ‘manage_options’ capability granted will get access to any admin menu item protected by ‘manage_options’ capability. Be careful, as ‘manage_options’ allows access to some critical menu items like “Settings”.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.