BuddyDev

Search

BuddyBlog Pro – override Submit Post for Review

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #48727

    Hi Nik,
    Thank you for sharing the details.
    I am going to test with the BuddyBoss platform today and will be writing back in couple of hours.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #48729

    Hi Nik,
    You were right. It was a bug on the post status in our code! I am going to talk to the concerned developer about the same as this happened due to duplicate status saving.

    I will push an update in an hour.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #48730

    Hi Brajesh

    Thank you so much for looking into this and I’m very glad you found something on your side. I tested so many different scenarios that I was starting to wonder if I was going a bit mad 😉

    Many thanks for sorting so promptly and I’ll look out for the update.
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #48731

    Hi Nik,
    I am sorry that you had to go through so much trouble.

    I worked on this project in collaboration with others in my team and somewhere while introducing the meta boxes for group workflow, the original post workflow was overridden incorrectly. That was the origin of the issue.

    Please upgrade to 1.0.0-RC6 which is available now.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #48732

    Hi Brajesh

    I really don’t mind. Indeed, I’m happy to do my bit to help things along when you offer such great support yourself 😉

    I’ve now tested 1.0.0-RC6 and that all seems to be working as expected, so many thanks for sorting this out so promptly.

    I do, however, have a couple of queries as follows –

    1. Can you possibly give an example of how to use the filter ‘bblpro_default_post_status_for_user’? There are two scenarios in which I would like to use this to allow users to publish immediately (ie. without the need for approval) as follows –

    a) users with the role of ‘editor’ when posting both personal and group posts and
    b) group admins when posting in their own group, even if they are not allowed to override submission workflow ie. not allowed to change “Submit Post for Review”

    2. I appreciate this one might be tricky but my emails that get sent out when a post is submitted, all refer to the fact that the post will require approval eg. group admin email says “a new post has been received and you need to go and approve it”, user email says “we’ve received your post and will let you know once it has been received”.

    Obviously that will be true in most cases, but just wondering if there is any way of filtering the above if the post is being published immediately ie. doesn’t require approval? The ideal would be to have a different email which was sent out based on the post status, but failing that, an email token which could at least display the post status might be useful. Note: I’m now wondering if maybe a shortcode would be the answer eg. show this text if “pending”, show that text if “published”… I certainly don’t expect an immediate answer to this one but if you do happen to have any suggestions at all, they would be much appreciated.

    With many thanks as always
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #48737

    Hi Nik,
    Thank you.

    Please find the snippet for both the cases.

    
    
    // Allow editors to publish irrespective of form status.
    add_filter( 'bblpro_default_post_status_for_user', function ( $status, $user_id, $form_id, $post_id ) {
    	// can user edit other posts?
    	if ( 'members' === bblpro_get_form_type( $form_id ) && user_can( $user_id, 'edit_others_posts' ) ) {
    		$status = 'publish';
    	}
    
    	return $status;
    }, 10, 4 );
    
    // for group admint o always allow publish.
    add_filter( 'bblpro_default_post_status_for_user', function ( $status, $user_id, $form_id, $post_id ) {
    
    	if ( ! function_exists( 'bblgroups_get_post_group_id' ) || ! function_exists( 'groups_is_user_admin' ) ) {
    		return $status;
    	}
    
    	if ( 'groups' !== bblpro_get_form_type( $form_id ) ) {
    		return $status;
    	}
    
    	$group_id = bp_is_group() ? bp_get_current_group_id() : 0;
    
    	if ( ! $group_id && $post_id ) {
    		$group_id = bblgroups_get_post_group_id( $post_id );
    	}
    
    	if ( ! $group_id ) {
    		return $status;
    	}
    
    	if ( groups_is_user_admin( $user_id, $group_id ) ) {
    		$status = 'publish';
    	}
    
    	return $status;
    }, 10, 4 );
    
    

    I will check for the email tomorrow. It should not go to user. It is probably a regression. I will have a solution in next 2 days.

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #48746

    Thank you so much Brajesh – those snippets work perfectly.

    I’ll look out for any further thoughts on the emails in due course.

    Regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on #48945

    Hi Brajesh

    You mentioned you would try and get back with regard to the emails that get sent out, but not having heard anything yet, I’m wondering if I may not have explaiend things very well so thought I would try and outline a bit more clearly…

    Since most posts will require approval, the emails sent out in response to a post are as follows –

    1) On submission (to user): We will get back to you once your post has been approved.
    2) On submission (to admin/group admin): Please check and approve this post.
    3) On approval (to user): Your post has been approved.

    This all works fine until it is someone (eg. in my case admins, group admins and editors) whose posts do not require approval and get published immediately. In that case, it makes no sense for them to be receiving 1) or 2) since a) their post is already approved and b) in many cases, it will be their own post they’re being asked to approve.

    Ideal scenario when posts are published immediately (ie. without requiring approval) would either be that email 3) above gets sent out immediately OR failing that, no emails get sent at all.

    As always, any thoughts would be much appreciated.
    Regards
    Nik

  • Participant
    Level: Master
    Posts: 279
    NikB on #49083

    Hi Brajesh

    Sorry to be a pain but just wondering if you’d had a chance to look at this.

    If all else fails, would it at least be possible to stop (any) emails being sent out if the post is being posted by admin, an editor or a group admin?

    With many thanks again
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #49091

    Hi Nick,
    I am sorry, we haven’t been able to look into it.

    We will be assisting you this week with it.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved