We're merging with GenerateBlocks! Learn more here.

[Support request] Remove WPSP For Non Admin Uses

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Remove WPSP For Non Admin Uses

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7715
    Jake
    Participant

    Hi Tom,

    Is there a way to disable WPSP for non-admin users?

    Even when using a permissions plugin like: https://wordpress.org/plugins/capability-manager-enhanced/ I can’t see an easy way to disable WPSP for certain permission levels.

    Any ideas?

    Thank you for your help 🙂

    #7746
    Tom
    Keymaster

    Hi there,

    Give this a shot:

    add_filter( 'register_post_type_args', function( $args, $post_type ) {
        if ( 'wp_show_posts' !== $post_type ) {
            return $args;
         }
    
        $args['capability_type'] = 'manage_options';
    
        return $args;
    }, 10, 2 );

    Adding PHP: https://docs.wpshowposts.com/article/adding-php/

    Let me know 🙂

    #7754
    Jake
    Participant

    Hey Tom,

    I added the code above and can confirm that WPSP is no longer showing for “Authors”.

    How exactly is this code working? When will WPSP show/not show – is it only set to show when “Posts” are allowed?

    Thanks for the code, and thank you for clarifying 🙂

    #7771
    Tom
    Keymaster

    That code makes it so only users with the manage_options capability (admins) can see the admin area for Show Posts.

    Every user role has capabilities, with manage_options being one of the ones for admins.

    #7779
    Jake
    Participant

    Arrr that makes sense.

    So I could hence enable access to WPSP for say… Editors – by enabling this option https://imgur.com/a/CbmMcLk

    Thank you for the code + explanation Tom! 🙂

    #7789
    Tom
    Keymaster

    You can change manage_options to any one of these: https://codex.wordpress.org/Roles_and_Capabilities

    No problem! 🙂

    #10363
    Torbjörn
    Participant

    Any chance of this becoming standard (or “checkbox configurable” or similar)?
    I really don’t want to fiddle with custom PHP if it can be avoided because I can no longer say “look, it’s all out of the box” … and it hides functionality for the next guy that admins the site.

    WP itself disables stuff that has with structure/building the site to do, for roles like author and editors whom should only be concerned about content. WPSP should, as well.

    #10364
    Jake
    Participant

    Hey Torbjorn,

    I noticed that in the Capability Manager Enhanced plugin now has an option to enable Permissions for WPSP. It’s in the right hand pane of the plugin when you navigate to Users -> Capabilities, as seen here: https://imgur.com/a/5pDoXqc (“Post Lists”).

    This enabled you to control WPSPs permissions for your Authors/Editors/etc. just like you would a WordPress page/post – very handy! Pretty much all “Out of the box” now 🙂

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