Change WordPress user roles and capabilities › Forums › Bug Reports › User Access restrict to return 404 error
Tagged: post view restriciton
- This topic has 23 replies, 2 voices, and was last updated 7 years, 7 months ago by Vladimir.
-
AuthorPosts
-
29/03/2017 at 17:02 #3490gcacciolaParticipant
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!
30/03/2017 at 01:40 #3491VladimirKeymasterHi 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.
30/03/2017 at 13:32 #3492gcacciolaParticipant
Good I found a bug! Here you go, setup and result!
Obviously the user is in another role than the ones with granted permission.
30/03/2017 at 13:33 #3493gcacciolaParticipant31/03/2017 at 08:11 #3497VladimirKeymasterI 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?
31/03/2017 at 17:42 #3498gcacciolaParticipantHello, I think I found the cause of the problem!
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!
01/04/2017 at 01:02 #3499VladimirKeymasterHi,
Thanks for the information. I will wait a result.
05/04/2017 at 13:30 #3533gcacciolaParticipantHello, 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.
05/04/2017 at 15:51 #3536VladimirKeymasterHi,
I confirm the described issue with default option for access error action. I will develop the fix. Thanks for the help with discovering it.
06/04/2017 at 03:59 #3537gcacciolaParticipantHello 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
06/04/2017 at 06:27 #3538VladimirKeymasterHi 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.
09/04/2017 at 02:59 #3545VladimirKeymasterHi 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.
10/04/2017 at 14:50 #3546gcacciolaParticipantHello 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”!!!10/04/2017 at 15:00 #3547gcacciolaParticipantWell, 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
10/04/2017 at 15:33 #3548VladimirKeymasterHi 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.phpTo 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.
-
AuthorPosts
- You must be logged in to reply to this topic.