Change WordPress user roles and capabilities Forums How to or FAQ Including Tablepress in a Role

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6050
    edering
    Participant

    I can’t get Tablepress to show for a Role (my SDoL Admin role). I have all 5 capabilities for Tablepress Table selected. What’s weird is when I go to the Admin Menu, Tablepress does not even show as something I can show/block. How do I let the Role have access to all of Tablepress?

    #6053
    Vladimir
    Keymaster

    “Admin menu” shows menu items available to the selected role according to permissions granted to this role. When you need to look what permission/capability is required for some menu item, open “Admin menu” for “administrator” role, which has all existing capability by default.

    Table press is protected by these user capabilities:
    URE admin menu for TablePress

    #6055
    edering
    Participant

    thanks!

    #6059
    edering
    Participant

    Vladamir, I have something similar going on for the GTranslate plugin – https://wordpress.org/support/plugin/gtranslate/. I don’t see it in Admin Menu, and when I go to Administrator and look at Admin Menu, it shows “administrator.” https://www.screencast.com/t/s87umrEtcrHG How do I add access to that for a Role created in URE (one that is not the full-rights admin)?

    #6060
    Vladimir
    Keymaster

    Unfortunately, GTranslate developer uses ‘administrator’ role to protect its menu item under ‘Settings’ menu. Look at the gtranslate.php file, line #231:

    
    add_options_page(__('GTranslate Options', 'gtranslate'), 'GTranslate', 'administrator', 'gtranslate_options', array('GTranslate', 'options'));
    

    The only way to make possible to add access to this menu item for other roles except ‘administrator’ is to replace ‘administrator’ at this line with ‘manage_options’, or any other user capability suitable for your purpose.

    #7226
    edering
    Participant

    Hi Vladimir. Based o your response to my reply 23/10/2019, is there a way to do this in our functions file so we don’t edit their plugin? And, if so, can we have it set to the current setting of ‘administrator’ AND a second Role (‘sdol-admin’)? I don’t want to set it to Manage Options because we have several Roles that have access to that, and I would need to Block that in Admin Menu for them all.

    #7233
    Vladimir
    Keymaster

    Hi,

    It’s possible. Code below redefines gTranslate menu with ‘manage_options’ capability:

    
    add_action('plugins_loaded', 'redefine_gtranslate_menu');
    
    function redefine_gtranslate_menu() {
        
        remove_action('admin_menu', array('GTranslate', 'admin_menu'), 10 );
        add_action('admin_menu', 'replace_gtranslate_menu' );
        
    }
    
    function replace_gtranslate_menu() {
        
        add_options_page(__('GTranslate Options', 'gtranslate'), 'GTranslate', 'manage_options', 'gtranslate_options', array('GTranslate', 'options') );
        
    }
    
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.