Change WordPress user roles and capabilities Forums Bug Reports /wp-admin/edit.php?post_type=CPT_Name is blank

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2895
    porteightyinc
    Participant

    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_posts

    PAGES
    read_private_pages

    GENERAL
    read

    INVENTORY
    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_inventorys

    The 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.

    #2896
    Vladimir
    Keymaster

    Could 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.

    #2897
    porteightyinc
    Participant

    WP 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

    #2898
    porteightyinc
    Participant

    Apache/Php error log is merely reiterating what the WP Debug reported.

    #2899
    Vladimir
    Keymaster

    Thanks.

    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?

    #2905
    porteightyinc
    Participant

    The 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!

    #2906
    Vladimir
    Keymaster

    If 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.

    #2907
    porteightyinc
    Participant

    I 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 module

    #2908
    Vladimir
    Keymaster

    Right, 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…”.

    #2924
    porteightyinc
    Participant

    That worked. Thank you very much Vladimir!

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