Change WordPress user roles and capabilities Forums How to or FAQ Defining Posts View Access in php

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #7256
    Vladimir
    Keymaster

    Btw., if you use any caching plugin, try to use different computers for testing view access.

    #7257
    zunk
    Participant

    humm thanks for this support.
    So the problem comes from my side…

    I can’t check the same setting as yours, because I’ve deleted ‘subscriber’, ‘contributor’, ‘author’, ‘editor’ roles.
    I only create new roles with URE from none (“make copy of none”).
    At the moment, I do not use any capability for my roles.
    Any chance my prob could come from a capability missing (a one available in default “author” role)?
    🙁

    #7258
    Vladimir
    Keymaster

    Really, when you create new role as a copy of ‘none’, URE adds to it at least one capability – ‘read’. Does your role has it? I did not make tests with absolutely empty roles.

    It should not have difference what role do you use built-in or custom one. Role should exist and current user should have it.

    I used ‘author’ role as an example only, it does not play a key role, what role to use.

    #7259
    zunk
    Participant

    add_filter( ‘ure_content_view_access_data_for_role’, ‘my_content_view_access_data_for_role’, 10, 2 );

    function my_content_view_access_data_for_role( $restriction, $role_id ) {
    if ( $role_id==’soc2′ ) {
    $restriction[‘access_model’] = 2;
    $restriction[‘access_error_action’] = 1;
    $restriction[‘data’][‘posts’] = array(49, 101, 100, 99);
    }
    return $restriction;
    }

    I’ve delete the rest of my php for a try, then desactivate all my plugins.
    I’ve put the same setting in the post 99:
    – View Access: Prohibit view;
    – For Users: All visitors (logged in or not);
    – Action: Return HTTP 404 error.
    The 49, 101, and 100 use this settings:
    View access: “Allow View”
    For user: Any User Role
    Action : Return HTTP 404 Error

    it works for 49, 101, 100 but the 99 is still prohibited.
    I really don’t understand my instal is pretty new.
    I’ve create another user and a new role with “Read” capability, but this is the same. I do not have cache plugin, and I can see any change I do in live.

    Last hope could be a setting into URE settings that I miss or that I should uncheck?
    I’ve also tried with “post_type Page” and it is the same than with a Custom Post Type..

    #7260
    Vladimir
    Keymaster

    Look if 99 post has category, which also has view restriction at category level. It’s just assumption about possible conflict with a hook. It should not take place though.

    It it will not help. I can look at your data on site tomorrow. If it’s applicable send URL and admin login credentials to support [at-sign] role-editor.com

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.