• Resolved Iamhere

    (@iamhere)


    Hi there,

    Thank you for the plugin which is awesome.

    However, with the customiser being inside the wordpress customizer menu, it is great for admins, but not so easy if you want to give access to an editor to be able to create their own notification – but not have full access to the entire customizer menu.

    Is there a way to move the notification bar settings out into its own menu item, or similar way to provide editor access?

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

    (@wpexplorer)

    Hi,

    This is AJ the developer. I decided to use the WP Customizer in order to make use of core WordPress functionality and keep the plugin slim without added bloat. And in general this functionality would be considered “admin” functionality as an “editor” is generally speaking a role used for post creation.

    Once solution would be to provide access to your editor to the Customizer (or a specific person if that’s the concern).

    But, it wouldn’t be hard to create a simple admin page just for changing the notice text and button text/link (that way you aren’t also giving access to the general settings). I don’t think this is something I would add to the core plugin but instead I can make a new quick plugin that creates the admin page for those that want it. I’ll try and knock that out in the next few days! It can take some time for plugins to be added here on the repository, but I can zip it over to you when it’s ready if you want (let me know).

    – AJ

    Thread Starter Iamhere

    (@iamhere)

    Hi Aj

    Fantastic mate. I guess the only issue is keeping it updated.

    Can you put a copy on Github – then others can access it and perhaps enhance it if needed?

    Plugin Author wpexplorer

    (@wpexplorer)

    This sort of plugin shouldn’t really need updates, but I will probably either dump it here on WP.org as well or consider adding it to the core plugin if I do get more requests. My concern though is that giving default editor access to the settings may not be a good idea.

    Here is a link to the project on Github – https://github.com/wpexplorer/admin-panel-for-easy-notification-bar/

    The admin should look like this: https://a.cl.ly/2NulN16P (kept it simple using only core WP functions).

    Let me know if you have any issues.

    – AJ

    Thread Starter Iamhere

    (@iamhere)

    Hi AJ

    That’s looks great. Editor should have access to colour options.

    Thanks

    Plugin Author wpexplorer

    (@wpexplorer)

    Hi,

    Adding custom color options to this backend panel will require registering custom scripts and javascript since there isn’t any native color picker you can use in custom admin screens. If I’m going to essentially just add every setting from the Customizer for editor access it really defeats the whole purpose of the addon plugin, since you could instead just add some code to your site to provide access to the customizer to your editor. Or perhaps you should consider just giving admin access to your editor.

    With the following code you could grant access to the Customizer to the editor role:

    get_role('editor')->add_cap('edit_theme_options');

    More info: https://developer.www.ads-software.com/reference/classes/wp_role/add_cap/

    Or even better you could do this using a plugin like the “User Role Editor” plugin.

    Of course, if you grant customizer access to your editor they will be able to edit everything in the Customizer. So one thing you could do is hook into the customizer to remove every section and panel besides the Easy Notification Tab from the editor role. This is quite simple. Example code: https://gist.github.com/wpexplorer/16828b7ebe898e8e105a508ed2fde39b (note this could may trigger some debug warnings in WP due to how they coded some things though, but I tested and didn’t see any actual issues).

    Screenshot of the result using the code above: https://a.cl.ly/z8ury7bw (you would need additional code if you want to hide the menu/widget panel in the WP admin, but that’s easy enough as well)

    That said, if you want your specific editor to be able to modify the design of your notification bar, I’m guessing you wouldn’t have any problem giving them access to all design aspects of the site, so perhaps just granting the editor role “edit_theme_options” rights (or a specific user on the site) would be the easiest for you. Giving access to modify the top bar means you have enough trust that they won’t add any SPAM to the top of your site site, so I’m thinking you should be able to trust them with full Customizer access.

    – AJ

    Thread Starter Iamhere

    (@iamhere)

    Thanks AJ

    The supplementary plugin works great. It would be nice to give colour options, something like this could be used?
    https://wordpress.stackexchange.com/a/304286/12651

    But how to apply

    I forked the github. I’ve added the color picker… but how to get it to apply the color chosen to execute on front end?

    https://github.com/wpexplorer/admin-panel-for-easy-notification-bar

    https://tinyurl.com/yxsn4fyj

    • This reply was modified 3 years, 3 months ago by Iamhere.
    • This reply was modified 3 years, 3 months ago by Iamhere.
    • This reply was modified 3 years, 3 months ago by Iamhere.
    Thread Starter Iamhere

    (@iamhere)

    Edit – I fixed it now – so all good ??

    https://github.com/wpexplorer/admin-panel-for-easy-notification-bar

    I added background color and text color

    I notice there does not appear to be a selector for the button background or text color – can that be added in the main plugin, then I can target it in the admin panel

    Thank you!

    Plugin Author wpexplorer

    (@wpexplorer)

    Hi,

    Sorry for the delayed reply, I didn’t get any notification of your reply and happened to see it when browsing through comments looking for another reply. Anyway I just finished adding those two options and I’m looking for a good way to reset the local storage keyName when changing the notice text when using the close button, once I resolve that I’ll push out the official update.

    Thank you for the recommendations, I hope you are having a nice holiday season!

    – AJ

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Allow editor access’ is closed to new replies.