BuddyDev

Search

BuddyBlog Pro – override Submit Post for Review

  • Participant
    Level: Master
    Posts: 203
    NikB on #47903

    Hi Brajesh

    Would there possibly be a way of overriding the “Submit Post for Review” for certain roles and/or group owners (so that their posts don’t require approval and are published immediately)?

    eg.

    1. Personal posts – currently I have users with “editor” status who use the (BuddyBlog) front end to add their posts, but then have to go to the dashboard to approve their OWN posts which is causing some confusion.

    2. Group posts – similar to the above, although in this case it can at least all be done in the front end, in this case, group owners have to approve their own posts before they are published (which seems like an unnecessary step).

    Any thoughts? The personal posts issue is the most significant for me currently…

    With many thanks in advance.
    Nik

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2541
    Ravi on #47908

    Hello Nik,

    Please try the following code and let me know if it helps or not

    
    add_filter( 'bblpro_form_post_status', function ( $post_status, $form_id ) {
    
    	if ( is_super_admin() || ! is_user_logged_in() ) {
    		return $post_status;
    	}
    
    	$form_type = bblpro_get_form_type( $form_id, 'members' );
    
    	if ( 'members' == $form_type ) {
    		// Replace with your roles.
    		$skipped_roles = array( 'editor' );
    		if ( 'pending' == $post_status && bblpro_user_has_role_in( get_current_user_id(), $skipped_roles ) ) {
    			$post_status = 'publish';
    		}
    	}
    
    	return $post_status;
    }, 10, 2 );
    
    

    Regards
    Ravi

    • This reply was modified 2 weeks, 6 days ago by Ravi.
  • Participant
    Level: Master
    Posts: 203
    NikB on #47915

    Hi Ravi

    Thank you so much for your quick and helpful reply.

    At least from tests so far, that seems to work perfectly.

    Regards
    Nik

You must be logged in to reply to this topic.

This topic is: not resolved