-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add specific capability for granular assignment. #29
Add specific capability for granular assignment. #29
Conversation
Thanks @jeffpaul. The only thing I'll say about this PR is that it currently fetches an option on every load because I don't really trust putting capability assignments behind |
Resolves #28 |
Hey @ethanclevenger91 - thanks for the PR! This looks like it will work...
Any reason in particular you don't trust this approach? It would be nice of the plugin to also remove the custom capability when it is deactivated which makes me lean towards adding on activation. Thoughts? |
@adamsilverstein In a very edge case, it could be circumvented through directly editing the active plugins value in |
I don't have a strong opinion either way and didn't find anything in our standards or prior art. I'm curious what @helen thinks. |
I don't know that I have a very strong opinion but to me it makes sense to tie it to activation and clean up on deactivation.
I think at the point of this happening you probably have a lot of other problems as well :) which isn't to say it's a dismissable concern, just that I wouldn't take that as the primary decider for an approach. |
@ethanclevenger91 Based on Helen's feedback, can you please update this PR to add/remove the custom capabilities during plugin activation/deactivation? |
@adamsilverstein will do |
@adamsilverstein updated, and also moved to main plugin file, since it didn't really feel like it fell under the same purview as the other contents of the admin.php file. |
@ethanclevenger91 thanks for updating this. I am wondering about one potential issue with adding the capability in the plugin activation hook: users who already have the plugin activated will not have the capability added and therefore won't be able to access the Ads-txt admin page. (oops, apologies for not catching this earlier when I suggested moving to activation) Two possible solutions for this issue would be:
My preference at this point is |
I pushed some updates:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement @ethanclevenger91 - thanks!
@adamsilverstein thanks for those improvements! I have criminally overlooked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Web UI isn't quite ready for prime-time usage, I suppose
Also assign cap to administrators, who were already the only ones able to edit this via the manage_options capability.