WordPress.org

Ready to get started?Download WordPress

Forums

User Role Editor
Allow editor access news announcements scroll plugin (9 posts)

  1. johhny
    Member
    Posted 1 year ago #

    Hi,
    I want the editor to have access to news announcement scroll. where can i edit? Thanks.

    http://wordpress.org/extend/plugins/news-announcement-scroll/

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

  2. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. johhny
    Member
    Posted 1 year ago #

    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.

  4. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. oneEcho
    Member
    Posted 1 year ago #

    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

  7. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

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

  8. oneEcho
    Member
    Posted 1 year ago #

  9. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic