Change WordPress user roles and capabilities › Forums › Bug Reports › /wp-admin/edit.php?post_type=CPT_Name is blank
- This topic has 9 replies, 2 voices, and was last updated 7 years, 11 months ago by porteightyinc.
-
AuthorPosts
-
23/10/2016 at 10:15 #2895porteightyincParticipant
Scenario
I have a custom post type called “Inventory” and a user role called “Dealer”. I am trying to lock down wp-admin users of the Dealer role to only be able to edit their Inventory posts and to not be able to even see other post types or WordPress setting (plugins, themes, users..everything that is not Inventory CPT related).
The Dealer role has the following capabilities
POSTS
read_private_postsPAGES
read_private_pagesGENERAL
readINVENTORY
delete_inventorys
delete_others_inventorys
delete_private_inventorys
delete_published_inventorys
edit_inventorys
edit_others_inventorys
edit_private_inventorys
edit_published_inventorys
publish_inventorys
read_private_inventorysThe Problem
Unless I give the Dealer role access to General/manage_options , which gives access to way too many WordPress setup admin items, then a Dealer user sees a blank white screen when they go to /wp-admin/edit.php?post_type=inventory screen (no WP errors, no php errors) IF they do not have any posts.23/10/2016 at 16:47 #2896VladimirKeymasterCould you temporarily set via wp-config.php the debug output for WordPress and let me know the error message?
May be you can look at the server PHP or Apache system logs to get more information about the reason of this problem.23/10/2016 at 21:38 #2897porteightyincParticipantWP Debug Enabled
—————————Notice: add_custom_background is deprecated since version 3.4! Use add_theme_support( ‘custom-background’, $args ) instead. in /public_html/wp-includes/functions.php on line 3573
Notice: add_custom_image_header is deprecated since version 3.4! Use add_theme_support( ‘custom-header’, $args ) instead. in /public_html/wp-includes/functions.php on line 3573
Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in /public_html/wp-includes/functions.php on line 3624
23/10/2016 at 21:44 #2898porteightyincParticipantApache/Php error log is merely reiterating what the WP Debug reported.
24/10/2016 at 00:46 #2899VladimirKeymasterThanks.
Temporal workaround: You may give ‘manage_options’ to the role for this user and use “Admin menu access” add-on to block extra menu items which will become available to the user after that.
Investigate a problem at the dev. copy. Try to deactivate all plugins (may be except one which creates a CPT inventory if you use some). Will it change situation?
26/10/2016 at 02:51 #2905porteightyincParticipantThe workaround appears to be working, thank you.
I do not have a separate dev environment to be testing that significant of changes at the moment. Also I setup the CPT in the functions.php file, I did not use a plugin to create it.
Aside from this issue, it appears I can give this restricted user access to “upload_file”. This gives them access to view files in the Media Gallery they did not upload. Can that be restricted so they can only see photos they uploaded?
Thank you Vladimir!
26/10/2016 at 03:04 #2906VladimirKeymasterIf user should edit just his own data remove ‘edit_others_inventorys’, ‘delete_others_inventorys’.
To hide from the listings the items created by other authors open ‘Posts Edit’ for the role and turn ON the “Own data only” checkbox.26/10/2016 at 03:57 #2907porteightyincParticipantI should have mentioned I did change the role’s Inventory permissions to only “edit_inventorys” and ” read_private_inventorys” . The only Post option the role has is “read_private_posts”.
I am not seeing “Post Edits” or “Own Data Only”….is there a particular Modules I need enabled for that? Right now I just have the following modules enabled:
– Activate Administrator Menu Access module
– Activate Other Roles Access module26/10/2016 at 06:23 #2908VladimirKeymasterRight, you need to activate the “Posts edit access restrictions” add-on.
I thought you activated it after reading this “…only be able to edit their Inventory posts…”.
31/10/2016 at 21:25 #2924porteightyincParticipantThat worked. Thank you very much Vladimir!
-
AuthorPosts
- You must be logged in to reply to this topic.