WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: User Role Editor] new capabilites for subheading

[Resolved] [Plugin: User Role Editor] new capabilites for subheading

  • babyoth

    @babyoth

    I’m using a the plugin called horizontal scrolling and I want the editor role to be able to see this settings page and not all the others settings under the setting subheading (general, writing…)

    Is anyone able to help me with this?

    So far I have added a new capability called manage_announcements but dunno what to do next

    http://wordpress.org/extend/plugins/user-role-editor/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Vladimir Garagulya

    @shinephp

    At line #306 of horizontal-scrolling-announcement.php file plugin author defines 2 menu items under ‘Settings’ menu:

    add_options_page('Horizontal scrolling announcement', 'Horizontal Scrolling', 'manage_options', __FILE__, 'HSA_admin_options' );
    	add_options_page('Horizontal scrolling announcement', '', 'manage_options', "horizontal-scrolling-announcement/horizontal-scrolling-setting.php",'' );

    It is impossible to leave them under ‘Settings’ menu and give access to them without access to others ‘Settigns’ menu items, as all of them use the same capability – ‘manage_options’.
    You can achieve your purpose just via modifying this plugin to use separate own menu with its own capability, e.g. ‘manage_announcements’.
    Let me know if you decide to proceed this way.

    babyoth

    @babyoth

    that sounds like what i’m looking for, could you give me more info on how I would do this please

    Plugin Author Vladimir Garagulya

    @shinephp

    As plugin shows only one menu item, I think that creating new submenu to it is too much. Let’s move ‘Horizontal Scrolling’ menu item from the ‘Settings’ menu to the ‘Tools’ menu. As ‘Tools’ menu is available for all users you can limit access to the ‘HS’ menu item easy. What you should do?
    change lines above to

    add_management_page('Horizontal scrolling announcement', 'Horizontal Scrolling', 'manage_announcements', __FILE__, 'HSA_admin_options' );
    	add_management_page('Horizontal scrolling announcement', '', 'manage_announcements', "horizontal-scrolling-announcement/horizontal-scrolling-setting.php",'' );

    Also you need to replace all occurrences of ‘options-general.php’ to the ‘tools.php’:
    line #156 should become:

    $mainurl = get_option('siteurl')."/wp-admin/tools.php?page=horizontal-scrolling-announcement/horizontal-scrolling-announcement.php";

    line #285:

    <td align="left" valign="middle"><a href="tools.php?page=horizontal-scrolling-announcement/horizontal-scrolling-announcement.php&DID=<?php echo($data->hsa_id); ?>">Edit</a> &nbsp; <a onClick="javascript:_hsadelete('<?php echo($data->hsa_id); ?>')" href="javascript:void(0);">Delete</a> </td>

    Lines 2,3 at button.php waits for your intervention with the same replace of ‘options-general.php’ with ‘tools.php’ too.

    babyoth

    @babyoth

    worked thanks, would be great if i could move it to media section, tried changing tools.php to upload.php but didn’t seem to change from tools section

    Plugin Author Vladimir Garagulya

    @shinephp

    Replace add_management_page() to add_media_page() additionally to change tools.php on upload.php and menu item will be moved to the ‘Media’ menu.

    babyoth

    @babyoth

    thanks, it works perfectly now 🙂

    just tried to delete an announcement and i got this error message

    “Fatal error: Cannot redeclare horizontal_scrolling_announcement() (previously declared in C:\Users\Jenny\xampp\htdocs\Wordpress\wp-content\plugins\horizontal-scrolling-announcement\horizontal-scrolling-announcement.php:20) in C:\Users\Jenny\xampp\htdocs\Wordpress\wp-content\plugins\horizontal-scrolling-announcement\horizontal-scrolling-announcement.php on line 58”

    is this because of something we did? because it worked fine before, i believe

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Plugin: User Role Editor] new capabilites for subheading’ is closed to new replies.