Home › Forums › Calendar Products › Community Events › The Access Control Option is not working properly
- This topic has 7 replies, 2 voices, and was last updated 9 years, 2 months ago by Barry.
-
AuthorPosts
-
March 12, 2015 at 8:43 am #947895Anthony D’ArcoParticipant
In the Community Event options it says, “Roles to Block.” So, I have check all the roles I want blocked (all but “Customer” which is created by WooCommerce). When not logged in, I do not have access. However, I logged in using a user that has a role of subscriber, and I can still access it even though they are “blocked” role.
I can give you a sample username and password to test this.
Thank you,
AnthonyMarch 12, 2015 at 1:54 pm #947989BarryMemberHi Anthony,
Sorry you’re experiencing difficulties.
Can you confirm first of all that in addition to checking off the roles you wish to block you also checked the Block access to WordPress dashboard setting?
If that’s all good then – just for the avoidance of doubt, though I do realize you indicated having already tried our standard troubleshooting steps when you opened this topic – can you confirm you tested for and found this wasn’t resulting from a theme or plugin conflict?
Thanks!
March 12, 2015 at 1:58 pm #947992Anthony D’ArcoParticipantI apologize, maybe I don’t understand what that setting is supposed to do. It blocks users from seeing the WpAdmin? I want them to not be able to add events to the form on the front end: http://www.sparkcommunity.org/events/community/list (although you won’t be able to see it, but you should get my gist.).
How do I protect THAT page from certain user rolls?
Thank you,
AnthonyMarch 12, 2015 at 3:00 pm #948012BarryMemberAhh, I see.
That setting exists to control access to the admin environment, not from the community submission form.
In this case you’re going to have to write a snippet to take care of your specific needs. In outline, I’d probably think of doing something like this:
- Hook into parse_request or some other suitable action and test to see if the request is for the submission page
- If it is, check out the current user’s role or whether they have some specific capability you are interested in testing against
- Depending on the outcome, redirect to an appropriate location
I hope that gives you some ideas – and good luck 🙂
March 12, 2015 at 3:03 pm #948014Anthony D’ArcoParticipantCould I potentially do this using a theme override? I don’t really feel comfortable doing what you just described, but if I can do it via theme override I think I could handle this.
March 13, 2015 at 8:46 am #948161BarryMemberHmm, well, you could certainly achieve something similar if you override the community/edit-event.php template to include some code like this near the top:
if ( ! user_can( 'minimum_capability' ) ) { echo 'Sorry you cannot submit events'; return; }
You would need to adjust the initial line to accurately target those roles/capabilities you are interested in here.
Does that help?
March 13, 2015 at 10:15 am #948200Anthony D’ArcoParticipantThat worked perfectly! Thank you.
March 13, 2015 at 10:19 am #948203BarryMemberAwesome – happy to help 🙂
-
AuthorPosts
- The topic ‘The Access Control Option is not working properly’ is closed to new replies.