Add settings to hide admin bar on the frontend with user roles#362
Add settings to hide admin bar on the frontend with user roles#362
Conversation
dkotter
left a comment
There was a problem hiding this comment.
This looks really good, thanks for all the work here. Left one minor comment on the label text but otherwise I saw only one issue.
If the plugin is network-activated, we have an option to either select settings that become the default for any newly created site (allowing someone to change those settings on a site-by-site basis) or enforce those settings across all sites (which means those settings can't be changed on a site-by-site basis).
It seems this new setting doesn't respect that. So if I network-activate the plugin and choose the enforce option, the option(s) I select for this new user role setting aren't enforced at the site-level and someone can still change that setting on a site level.
I didn't check the default option to see if that worked (requires creating a new site on the network) but I imagine that's probably not working either.
|
@dkotter Thank you for taking time in reviewing the feature and outlining the issue.
Yes, you were right about this. I updated the code and it should work fine now.
I tested this before making any changes, and it was working fine. It was just that enforce mode was having an issue. |
|
Thanks, @dkotter! Those two notices are different: one is for site visibility, and the other one is for restricted site access plugin. The first one is being added through blog_privacy_selector action, and we cannot combine these two as both are separate settings. I have explicitly added the second notice so that it shows only for the restricted site access in case we add more always-visible settings in the plugin. |

Description of the Change
This PR adds a new feature to hide the WordPress admin bar on the frontend for specific user roles. This addresses the common need for previewing sites to low-access users by providing a cleaner, distraction-free experience.
Key Features:
Implementation Details:
show_admin_barfilterhide_admin_bar_rolesto the plugin optionsCloses #354
How to test the Change
Setup:
Test Role Selection:
Test Admin Bar Hiding:
Test Admin Bar Visibility:
Test Network Settings (Multisite):
Changelog Entry
Credits
Props @sanketio
Checklist: