Home Forums Newsletter Plugin Support add_(sub)menu_page wrong usage

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7902
    Anonymous
    Inactive

    Hi,

    I was struggling with this myself and figured others might search for a solution and it might be a good improvement on a future version of the plugin.

    I’m using a WordPress installation together with the plugins ‘Members’, which can create custom roles and edit their capabilities.

    I created a new role and found that the entire admin sidebar menu for Newsletter was gone. I started digging through the code and found that the usage of the WordPress functions add_menu_page and add_submenu_page rely on the editor option that can be set in the configuration of Newsletter. As is stated here, using user levels in these functions are deprecated and I managed to fix the required functionality by replacing 3 instances with manage_options in:

    includes/module.php
    plugin.php

    Hopefully this will help some people and we can see this fixed in a newer version of Newsletter, I love the plugin!

    #7903
    Stefano
    Keymaster

    Hi thank you for your improvement to the menu system. Can you send me the code so I can commit the changes? Have you changed even the configuration panel where one can choose to enable the plugin access even to editors?

    Thank you, Stefano.

    #7921
    Anonymous
    Inactive

    Hi,

    I have not done anything with the configuration panel nor have I tested the rest of the plugin extensively with the changes. That might perhaps be a good idea to do 😛

    the changes I made were in includes/module.php line 447:

    add_submenu_page('newsletter_main_index', $title, $title, 'manage_options', $name, $name);

    and line 459

    add_submenu_page(null, $title, $title, 'manage_options', $name, $name);

    and in plugin.php on line 218

    add_menu_page('Newsletter', 'Newsletter', 'manage_options', 'newsletter_main_index');

    Hope this helps and comes right through testing 🙂

    Sincerely, Simone

    #7922
    Stefano
    Keymaster

    Ok thank you, I need to change the way the blog owner can enable users with different capabilities (eg. editors) to access the newsletter. I know that WordPress deprecated the user levels, even if when a user level is something that define a set of capability, I don’t find it too strange to keep them and adopt them.

    But maybe I’m used too much with system which have operators group with capabilities which are passed to every operator inside the group. 🙂

    I’ll look at how to change the plugin.

    Stefano.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.