2

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.

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?

5

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
  • Thanks for a great answer :) I will probably change the code to the plugin, and update the code each time it get's updated. Mainly because it's an essential part of the site. The page is actually just a library for the video gallery with options to add youtube links and edit gallery items, so I don't see the point in not being able to give them access. – turtledropbomb Mar 14 '14 at 11:09
  • Then you really ought to contact the plugin author. – s_ha_dum Mar 14 '14 at 13:54
0

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')); 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.