No access – 404 error
-
I’m using UAM with custom post types. When user dont have access and visit page he gets 404 error. How to fix this?
-
If the content is completely hidden that’s the default behavior. 404 means not found, which should be the result if something is completely hidden because you have no access.
But its not.
When I use UAM on normal post or page its work fine and show
“Content displayed if user has no access.”
When I do same thing for my custom type post unlogged user get 404 error.
Pls helpStill can’t fix it.
For normal post and page UAM works fine and show information that content is blocked. But when I check any group in metabox (custom type post) User which dont have access gets 404 error. How to fix this and display information “content is blocked” insted 404 page?
Pls Help
For custom post types the hide complete option is the default one, which is currently not changeable, it’s only selectable for build in posts and pages. I think I will change that at a future release.
Is there any chance for quick fix to make it only work for one custom post type?
Or maybe there is easy way to change default settings?
Someone help?
My solution was to use this plugin https://ww.wp.xz.cn/plugins/members/ for create new roles and restrict content.
-
This reply was modified 9 years, 4 months ago by
Felipe Viana.
@deathsin321 You have to change the code related to the object type at the config class, see for example: https://github.com/GM-Alex/user-access-manager/blob/master/class/UamConfig.php#L168
Check if the object type isn’t a post or a page and if so change it to page or post to inherit the behavior of the post or page settings.
I think I’m not good enough in php to do this. Can you give me some more advice?
Can you please address this issue in the next update? I tried to set up a login page that catches users trying to access my hidden content, instead of the 404 page but I cannot avoid the 404 page no matter what settings I select from the UAM settings panel.
My eventual solution was to add some code to my 404 page template that checks the page url for the custom post type slug, if true it shows the login form and if false shows the 404 page as it should.
See below for those with a similar issue:
<?php $url = $_SERVER['REQUEST_URI']; if(strpos($url, 'custom-post-type-slug') == true){ $args = array( 'form_id' => 'loginForm', 'label_username' => __( 'Username' ), 'label_password' => __( 'Password' ), 'label_remember' => __( 'Remember Me' ), 'label_log_in' => __( 'Log in to view content' ), 'remember' => true ); wp_login_form( $args ); } else if (strpos($url, 'custom-post-type-slug') == false) { // 404 page content here } ?> -
This reply was modified 9 years, 4 months ago by
The topic ‘No access – 404 error’ is closed to new replies.