• Resolved klishb

    (@klishb)


    I have a plugin (WPFront Notification Bar) that uses the capability manage_options to provide access to the plugin settings. I’m trying get this separated on it’s own custom capability so I can give access to site staff without giving them access to site administration settings.

    WPFront Notification Bar support says I can add a define a constant in wp-config.php to change the capability that it uses. I have done this by putting this in my wp-config.php:

    `define(‘WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY’, ‘WPFRONT_NOTIFICATION_BAR_EDITOR’);

    When I did that I lost access to the settings so I know that part worked. I then added WPFRONT_NOTIFICATION_BAR_EDITOR as a custom capability using Members to the Administrator role. I can see it got added and the box is checked to give access to the Administrator role. For some reason that doesn’t give me access to the plugin settings as expected.

    Not sure what I’m missing and I’m not getting much more support from their team. Any thoughts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter klishb

    (@klishb)

    Sorry about funny quotes in my post. It’s not that way in my wp-config.php. The editor did not properly add a code block like it should on this forum.

    Plugin Author Caseproof

    (@caseproof)

    Hi @klishb

    Could you add this capability in the Members’ Role Editor: wpfront_notification_bar_edit_cap and grant your role this capability? After that, add the code below at the end of your theme’s functions.php file:

    add_filter('wpfront_notification_bar_edit_capability', function($cap) {
      return 'wpfront_notification_bar_edit_cap';
    });

    Hopefully, that helps.

    Thread Starter klishb

    (@klishb)

    Yes that worked. Thank you! Any idea what I was doing wrong?

    Plugin Author Caseproof

    (@caseproof)

    I think that using a filter hook is better than adding constant to wp-config.php file.

    I’m glad to hear that it works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trouble giving custom capability’ is closed to new replies.