WordPress.org

Support

Support » Plugins and Hacks » User Role Editor » Allow editor access news announcements scroll plugin

Allow editor access news announcements scroll plugin

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

    @shinephp

    Hi,

    Plugin adds its menu item to the ‘Settings’ menu, which is limited by ‘manage_options’ capability. You can give such capability to your editor role, but such editor will have access to all your blog Settings menu.
    news-announcement-scroll.php file, line #145:

    function news_announcement_add_to_menu()
    {
    	add_options_page('News announcement scroll', 'News announcement scroll', 'manage_options', __FILE__, 'news_announcement_admin_options' );
    	add_options_page('News announcement scroll', '', 'manage_options', 'news-announcement-scroll/setting.php','' );
    }

    Workaround is to create separate submenu for this plugin with its own custom created capability. Let me know if you need further assistance.

    Hi Vladimir, thanks for your respond.

    I take a look at the coding inside news-announcement-scroll.php file and I see this

    if (is_admin())
    {
    	add_action('admin_menu', 'news_announcement_add_to_menu');
    }

    Is it possible if i create the similar for editor?

    And how can I create separate submenu for this plugin?

    Thanks.

    Plugin Author Vladimir Garagulya

    @shinephp

    Do not touch code you showed above. is_admin() checks if you at admin back-end, not if you are administrator. This code just calls function which I showed you, it is defined at line #145.
    If you wish to define separate submenu for this plugin use this code:

    add_menu_page('News scroll', 'News scroll',  'news_announcement_scroll', 'news-announcement-scroll',  'news_announcement_admin_options');
        add_submenu_page('news-announcement-scroll', 'News announcement scroll', '', 'news_announcement_scroll', 'news-announcement-scroll-settings', 'news-announcement-scroll/setting.php');

    Replace function news_announcement_add_to_menu() body with it.
    It is not enough to make just these changes.
    You should create new capability ‘news_announcement_admin_options’ and go through plugin’s php files and change links there from ‘options.php’ to ‘admin.php’
    I did not tested and it could not work from the first try.

    Plugin Author Vladimir Garagulya

    @shinephp

    Update:
    Use this code instead

    add_menu_page('News scroll', 'News scroll',  'news_announcement_scroll', 'news-announcement-scroll',  'news_announcement_admin_options');
        add_submenu_page('news-announcement-scroll', '', '', 'news_announcement_scroll', 'news-announcement-scroll-settings', 'news_announcement_settings');

    add this function to news-announcement-scroll.php file:

    function news_announcement_settings() {
    
      include 'setting.php';
    
    }

    replace in all links where you see options-general.php this text

    options-general.php?page=news-announcement-scroll/news-announcement-scroll.php

    to

    admin.php?page=news-announcement-scroll

    and this text

    options-general.php?page=news-announcement-scroll/setting.php

    to

    admin.php?page=news-announcement-scroll-settings

    Then it should work. I hope you got the idea.

    Hi Vladimir, I think this thread is similar to the problem I’m having. I’d like my editor role to have access to a number of (around 6) plugins of my choice. Can you tell me how this can be achieved please. Thanks

    Plugin Author Vladimir Garagulya

    @shinephp

    Hi,

    send link to one of your plugin here. I will show you, what could be done with it.

    Plugin Author Vladimir Garagulya

    @shinephp

    Open easyrotator.php, go to line #133, look for function hook_admin_menu() there. Plugin’s menu is defined by three lines

    $hookname = add_menu_page( $primary_title, 'EasyRotator', 'edit_posts', $primary_slug, array( $this, 'admin_page_overview' ), 'div' );
    
    // Add submenu pages - first is just mirror of main.
    add_submenu_page( $primary_slug, $primary_title, 'Overview', 'edit_posts', $primary_slug, array( $this, 'admin_page_overview' ) );
    $hookname_sub1 = add_submenu_page( $primary_slug, 'EasyRotator - Help', 'Help', 'edit_posts', 'easyrotator_admin_help', array( $this, 'admin_page_help' ) );

    This plugin uses ‘edit_posts’ capability to check if user can use it or not. Change this capability to any other (even your custom created one) according to your needs.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Allow editor access news announcements scroll plugin’ is closed to new replies.
Skip to toolbar