The Access Control Option is not working properly

Home Forums Calendar Products Community Events The Access Control Option is not working properly

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #947895
    Anthony D’Arco
    Participant

    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,
    Anthony

    #947989
    Barry
    Member

    Hi 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!

    #947992
    Anthony D’Arco
    Participant

    I 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,
    Anthony

    #948012
    Barry
    Member

    Ahh, 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 🙂

    #948014
    Anthony D’Arco
    Participant

    Could 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.

    #948161
    Barry
    Member

    Hmm, 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?

    #948200
    Anthony D’Arco
    Participant

    That worked perfectly! Thank you.

    #948203
    Barry
    Member

    Awesome – happy to help 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘The Access Control Option is not working properly’ is closed to new replies.