BuddyDev

Search

[Resolved] BuddyPress Notify Post Author on Blog Comment , modification possible?

  • Participant
    Level: Enlightened
    Posts: 22
    Michael on #46189

    Hi Brajesh,

    I installed your plugin BuddyPress Notify Post Author on Blog Comment today, works great.

    Question: can this be modified so that Admin does not receive notifications?

    Looking at the plugin code, I see a bunch of “if/return early” statements for when a notification should not get sent.
    Could I simply add a quick “check for admin capability” onto that list? Or is there a better way?

    eg.

    `
    //is the post author an admin?

    if ( user_can( $post->post_author, ‘manage_options’ ) ) {
    return;
    }

    `

  • Keymaster
    (BuddyDev Team)
    Posts: 24262
    Brajesh Singh on #46201

    Hi Michael,
    Thank you for the question.

    WordPress does have the ability to notify admins out of the box. Please visit Dashboard->Settings->Discussion to configure it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 22
    Michael on #46211

    Hi Brajesh,

    thanks, to clarify: I want authors to receive on-site notifications about comments on their posts, but Admin should NOT receive on-site notifications about comments on his (Admin’s) posts.

    So I want to opt-out Admin from the functionality of your plugin.

    The Dashboard>Settings>Discussion option refers to email notifications, I believe. So I don’t think that will help.

    Current behavior after activating plugin:

    – Authors receive on-site notifications about comments on their posts (great!)
    – Admin receives on-site notifications about comments on his own posts (not desired)

    Thanks.

  • Keymaster
    (BuddyDev Team)
    Posts: 24262
    Brajesh Singh on #46220

    Hi Michael,
    Thank you.

    Please change this line

    https://github.com/buddydev/bp-notify-post-author-on-blog-comment/blob/master/bp-blog-comment-notifier.php#L349

    from

    
    
    if ( bp_is_active( 'blogs' ) && ! bp_disable_blogforum_comments() ) {
    			return;
    		}
    

    to

    
    if ( bp_is_active( 'blogs' ) && ! bp_disable_blogforum_comments() ) {
    	return;
    }
    
    if ( is_super_admin( $user_id ) ) {
    	return;
    }
    
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 22
    Michael on #46241

    Thanks very much Brajesh, I appreciate your generous assistance.

  • Keymaster
    (BuddyDev Team)
    Posts: 24262
    Brajesh Singh on #46249

    You are welcome.

The topic ‘ [Resolved] BuddyPress Notify Post Author on Blog Comment , modification possible?’ is closed to new replies.

This topic is: resolved