How can I change plugin to give access to editor user role?

I want to give my editors access to a settings page to a plugin I’ve installed on their website. As of now, it’s only visible to Administrators.

The plugin I’m using is uTubeVideo Gallery, and there is no option to give users other than administrators access.

Read More

In his admin.php I found these lines, which I know creates the settings page:

public function addMenus()
{
    add_menu_page('uTubeVideo', 'uTubeVideo', 'manage_options', 'utubevideo_settings', array($this, 'option_panel'), plugins_url('utubevideo-gallery/i/utubevideo_icon_16x16.png'));
    add_submenu_page('utubevideo_settings', 'uTubeVideo Galleries', __('Galleries', 'utvg'), 'manage_options', 'utubevideo_settings_galleries', array($this, 'gallery_panel')); 
}

Is there a way for me to tweak his code so I can give access to editors?

Related posts

Leave a Reply

2 comments

  1. The manage_options argument you see in both function calls is a capability. That particular capability makes the page accessible only to administrators.

    To make this work, you could change that to one of the editor capabilities like edit_others_posts You could also create a new capability and use that.

    However, doing either will mean hacking the plugin and the next time the plugin is updated your changes will be overwritten, which is why hacking plugins is generally a bad idea

    I would:

    1. Think carefully about why editors need access to this global
      settings page. “Editors” are logically a “content” role, not a
      “global site administration” role, which is what you seem to be
      partially converting them to.
    2. Consider whether what editors need is perhaps a shortcode or other
      simplified access to the plugin functionality.
    3. If neither #1 nor #2 fit, contact the plugin author and find out why access is
      limited and whether the author would be willing to change the plugin
      code
  2. Try with

    public function addMenus()
    {
       add_menu_page('uTubeVideo', 'uTubeVideo', 'delete_posts', 'utubevideo_settings', array($this, 'option_panel'), plugins_url('utubevideo-gallery/i/utubevideo_icon_16x16.png'));
       add_submenu_page('utubevideo_settings', 'uTubeVideo Galleries', __('Galleries', 'utvg'), 'delete_posts', 'utubevideo_settings_galleries', array($this, 'gallery_panel')); 
    }