Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress Permissions


  • Lauren Pittenger
    Participant

    @lepittenger

    Hi all,

    I am on the hunt for a solution that will allow me to give users permission to edit a single page as well as create posts within a custom post type and create regular posts within only a particular category. Anyone know of any plugin that does this? I’m looking at Press Permit Pro but unsure.

    I know this isn’t quite buddypress related, but we are using BP on this same site.

    Thanks!!

    Lauren

Viewing 3 replies - 1 through 3 (of 3 total)

  • Henry Wright
    Moderator

    @henrywright

    Hey @lepittenger

    There may be a plugin out there that can do all that you need but you may be able to achieve what you need without a plugin

    WordPress uses Roles and Capabilities to dictate what a user can and cannot do.

    Take editing a page for example. Any user with a role of Editor or above will be able to do that so all you’d need to do is change the user’s role via the admin area.

    Hope this helps!


    Lauren Pittenger
    Participant

    @lepittenger

    Thanks for the reply @henrywright

    I actually need to be able to allow a user to only have editing access to certain pages though. I don’t want them to be able to edit all of the pages, only the ones I give them access to

    Thanks though


    Henry Wright
    Moderator

    @henrywright

    @lepittenger Right, I see now. Looking at wp_insert_post(), all I can see that’s available to hook into is wp_insert_post_empty_content

    Perhaps try something like this:

    function lepittenger_custom_edit_page( $maybe_empty, $postarr ) {
    
        // Your page ID here.
        $page_id = 962;
    
        // Your user ID here.
        $user_id = 3;
    
        // Get the post's info.
        $post = get_post( $postarr['ID'] );
    
        if ( ( $post->ID == $page_id ) && ( get_current_user_id() != $user_id ) )
            return true;
            
    }
    add_action( 'wp_insert_post_empty_content', 'lepittenger_custom_edit_page', 10, 2 );

    This is a bit cheeky because we’re tricking WP into thinking the post is empty which results in it aborting the update. But, I can’t think of a better way

    Please note I haven’t tested.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘BuddyPress Permissions’ is closed to new replies.
Skip to toolbar