Change WordPress user roles and capabilities Forums Bug Reports User Access restrict to return 404 error

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #3490
    gcacciola
    Participant

    Hello, my name is Giacomo, first of all, congratulations on the great plugin, it solves me a lot of different problems I had. I bought your plugin because the guys from the theme woffice (intranet) suggested and tested.
    The “bug” I am facing is when I restrict a user to view a certain page, I was supposed to choose the behavior of the screen that is shown to the blocked user. There are 3 options: 404 error, access error and custom error.

    When I choose 404 or access error, the user gets shown a blank page. If I choose custom error, the text comes fine.

    I have typed a wrong url on my address bar and the themes 404 gets shown ok, but when it is through URE it doesn’t. Am I doing something wrong?

    Thank you!

    #3491
    Vladimir
    Keymaster

    Hi Giacomo,

    Thanks for the good feedback.

    You found a real bug. Thanks a lot. I confirm the case when these settings for post:
    “Prohibit View – All visitors – Show access error message” returns 404 error instead of showing a globally set error message. I will re-test all options and publish the update in the 1st week of April.

    I always get a 404 page from the active theme for ‘Return 404 HTTP error’ option although.

    Show a screenshot of the settings you made for your post which produces unexpected result. I will test them with a double attention.

    #3492
    gcacciola
    Participant

    ss1
    ss2

    Good I found a bug! Here you go, setup and result!

    Obviously the user is in another role than the ones with granted permission.

    #3493
    gcacciola
    Participant

    https://ibb.co/nMGc1F

    https://ibb.co/gKOeFa

    Try the links by themselves

    #3497
    Vladimir
    Keymaster

    I get the ordinal 404 page (like 404.php from 2017) from the active theme with the same setting for post: for not logged-in user or for logged-in user with role not allowed for this post tries access page’s URL directly.

    Did you try a WordPress default 2017 theme?

    #3498
    gcacciola
    Participant

    Hello, I think I found the cause of the problem!

    https://ibb.co/jLa1Tv

    As you can see on the screenshot. The theme itself has its own ( Less powerful ) access control, even if they are not enabled, it is causing conflict. If I disable URE, the theme’s access control returns the 404 fine. But if URE is enabled, it gets a blank page. I am no programmer, but I’ll contact the theme developers.

    On the regular 2017 theme it works wonders.

    I’ll let you know what happens.

    Regards!

    #3499
    Vladimir
    Keymaster

    Hi,

    Thanks for the information. I will wait a result.

    #3533
    gcacciola
    Participant

    Hello, I am still researching the subject, I found that for custom post types, the behavior is fine, but for pages only that the above erratic behavior is still happening. I have received the response from the theme developer but I still have to test it.

    One other thing that I noticed, is that on the URE options, even if I select 404 as a default, when I create new pages the default option that comes selected is: “Show access error message”

    This is how it is setup:

    Content view restrictions

    Activate [user_role_editor roles=”role1, role2, …”] shortcode
    Activate content view restrictions
    Defaults:
    View access:
    Allow View
    Prohibit View < —– This is the one selected.
    For Users:
    All visitors (logged in or not) < —– This is the one selected.
    Any User Role (logged in only)
    Selected User Roles / (logged in only)
    Action:
    Show Access Error Message
    Return HTTP 404 error < —– This is the one selected.

    Can you please check?

    Keep up the good work. URE is fundamental to my intranet.

    #3536
    Vladimir
    Keymaster

    Hi,

    I confirm the described issue with default option for access error action. I will develop the fix. Thanks for the help with discovering it.

    #3537
    gcacciola
    Participant

    Hello Vladimir, I am glad I helped you.
    Here is the link to my ticked opened at the Theme’s support forum, they are usually very helpful!
    https://alkaweb.ticksy.com/ticket/1117251
    Can you take a look and see if there is something we can figure out together? I realized that for posts themselves is working fine the 404 thing it is even working for custom post types, the problem is actually happening on PAGES restrictions.

    Regards

    Giacomo

    #3538
    Vladimir
    Keymaster

    Hi Giacomo,

    I found a copy of wOffice v. 2.3.3, activated it and allowed with URE to view one page for administrator and editor roles with 404 error in case of access error, exactly as on your screenshot. Then I logged-in with subscriber role and tried to view that page. I got a theme’s 404 page.

    If it’s possible to get from you the latest woffice version, I’m ready to repeat this test with it. I install commercial products at my local development environment only.

    #3545
    Vladimir
    Keymaster

    Hi Giacomo,

    A quick fix to the issue with access error action HTTP 404 default value for a new added post is to replace line #166 at pro/includes/classes/content-view-restrictions.php from

    
    $content_view_access_error_action = apply_filters('ure_default_post_access_error_action', 2);
    

    to

    
    $content_view_access_error_action = apply_filters('ure_default_post_access_error_action', $content_view_access_error_action);
    

    I included this fix into upcoming update v. 4.33.1, which I plan to publish in a week.

    #3546
    gcacciola
    Participant

    Hello Vladimir, how are you, I am sorry, I was out of the office for a while. Do you still need the theme files? What’s the easiest way to send you?
    I Was happy to try your solution, but something very weird happened, I went to the path you wrote above, and in my user-role-editor-pro/includes/classes, there are no files named “content-view-restrictions.php”!!!

    #3547
    gcacciola
    Participant

    Well, I have just downloaded a fresh version of URE pro from your site, and there is still no file with that name there!
    I know the update comes in a week, but it is just to let you know that something is wrong!
    Regards!

    Giacomo

    #3548
    Vladimir
    Keymaster

    Hi Giacomo,

    That was a relative path inside URE Pro’s folder.
    Full path: wp-content/plugins/user-role-editor-pro/pro/includes/classes/content-view-restrictions.php

    To send a theme copy upload it to Google Doc or DropBox service and send me (support [at-sign] role-editor.com) the invite for that .zip file.

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.