BuddyDev

Search

BuddyBlog Groups – Notification Filters

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

    Hi Brajesh

    Request in brief – if at all possible, it would be really useful to have two additional filters in BuddyBlog Groups (similar to “bblpro_groups_post_submission_notify_author”) to allow filtering of the admin and group admin notifications (similar to what already exists in BuddyBlog Pro for admin and author notifications).

    Longer explanation (if needed) –

    The default workflow for all posts on my site is that they are submitted for review upon submission.

    I use the bblpro_default_post_status_for_user filter to allow posts by certain users (ie. editors and group admins) to be published immediately (ie without approval).

    If a post is submitted/published without requiring approval, I want to prevent admin, author and group admin (if relevant) notifcations from being sent out.

    With BuddyBlog Pro, this works very well using the following code/filters –

    /**
     * Skip notification on post submit
     *
     * @param null    $skip_notify  Need to notify or not.
     * @param WP_Post $post         Post object.
     * @param int     $form_id      Form id.
     *
     * @return mixed
     */
    function buddydev_skip_post_submit_notification( $skip_notify, $post, $form_id ) {
    
    	if ( 'publish' === bblpro_get_default_post_status_for_user( get_current_user_id(), $form_id, $post->ID ) ) {
    		$skip_notify = true;
    	}
    
    	return $skip_notify;
    }
    add_filter( 'bblpro_pre_handle_post_submission_admin_notification', 'buddydev_skip_post_submit_notification', 10, 3 );
    add_filter( 'bblpro_pre_handle_post_submission_author_notification', 'buddydev_skip_post_submit_notification', 10, 3 ); 

    My one remaining request would be to be able to achieve similar for BuddyBlog Group posts. I understand that the new “bblpro_groups_post_submission_notify_author” filter will allow me to “skip” the author notification, ideally what I would like to see would be two additional filters eg. something along the lines of “bblpro_groups_post_submission_notify_admin” and “bblpro_groups_post_submission_notify_group_admin”.

    I do hope this helps to clarify but any queries, please do let me know. I really do appreciate all your efforts to accommodate this if at all practical.

    Regards
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #49213

    Hi Nik,
    Thank you.
    It makes a lot of sense.

    Please allow me to push an update by tomorrow.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #49225

    Hi Nik,
    Thank you for your patience.
    Please upgrade to RC8.
    I have added following filters in 1.0.0-RC8

    
    bblgroups_pre_handle_post_submission_author_notification
    bblgroups_pre_handle_post_submission_admin_notification
    bblgroups_pre_handle_post_submission_group_admin_notification
    
    bblgroups_pre_handle_post_approval_author_notification
    bblgroups_pre_handle_post_rejection_author_notification
    
    

    All of these have same signature

    
    apply_filters( 'bblgroups_pre_handle_post_submission_author_notification', null, $post, $form_id, $group_id )
    
    

    If you return first parameter as true, the notification will be stopped.

    Hope that helps.

    Regards
    Brajesh

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

    Hi Brajesh

    Thank you so much. Those filters should allow me to achieve everything I need to achieve (and hopefully will be helpful to others too), so really appreciate it.

    I will of course test and let you know if I run into any queries 😉

    Regards
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #49227

    Thank you Nik.
    I look forward to your test and feedback.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved