Skip to:

Confused and confusing email notifications

  • I am running this—absolutely lovely, a million thanks—plugin together with the plugin Activity Stream Bump to Top by @nuprn1 which copies the original date_recorded to the activity_meta table when a new comment is posted to an activity record and then overwrites the activity date_recorded with the last activity comment reply date. This leads to numerous email notifications being sent out of the same item, because, understandably, the system thinks the whole record is new, while it really isn’t. Is there anything that can be done to correct this behaviour short of disabling the activity bump plugin?

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

  • Dwenaus


    We decided to structure our plugin based on the activity stream, this has the benefits that all other plugin notifications just work. However plugins like the bump to top are messing with the natural flow of the buddypress universe so will break things. It could probably add some action hooks and then check to see if the activity has already been sent, there would be much overhead but it could work.

    having written all that, i now realize this could be a bug in the system as well, and not due to the bump plugin. Due to the way buddypress stores comments on activity stream posts, it is very difficult to know which group it came from. So the email that goes out is for the original activity and not the comment. I could be wrong here. But this is something that could be fixed if it really is an issue.

    lots of maybes because i don’t have the time right now to troubleshoot this stuff. let me know if it’s a big priority.

    cheers mate!

    That is a lot of maybes right there isn’t it? No big user-priority yet, I don’t have complaints yet, only questions of curiosity… It is very annoying though, and I would be happy to help in tracing the issue when you have some time to troubleshoot.

    Complaints are increasing, unfortunately. Is there anything I can do to help locate the cause for the dilemma?

    Boone Gorges


    I just took a peek and here’s a strategy that should work, though I don’t have time at the moment to sort it out myself.

    Rich’s plugin stores the original date_recorded to an activity meta item. Since you don’t want to send a second notification for items that have been bumped, you should be able to use the presence of this piece of activity metadata as a trigger to stop the email from firing.

    Here’s how I might go about it. The function that sends the activity notification (for non forum-related activity) is ass_group_notification_activity(). That function is hooked like so:
    `add_action( ‘bp_activity_after_save’ , ‘ass_group_notification_activity’ , 50 );`
    So, if you want to keep the email from firing, you’ll have to run a custom function before this hook is activated. Since the priority is set to 50, it’s easy to catch it beforehand. Here it is in 100%, off-the-top-of-my-head, untested code:

    `function bbg_block_bumped( $activity ) {
    // Look to see if it’s been bumped
    $date_recorded = bp_activity_get_meta( $activity->id, ‘bp_activity_bump_date_recorded’ );

    // If so, remove the email sender
    if ( $date_recorded )
    remove_action( ‘bp_activity_after_save’ , ‘ass_group_notification_activity’ , 50 );
    add_action( ‘bp_activity_after_save’ , ‘bbg_block_bumped’ , 4 );`

    Oh snap, seems the forums don’t have the plugin installed we are talking about eh? Only saw your suggestion now, Boone, will try as soon as I have a moment tonight! I’ll report back – Cheers Andreas

    I am happy to report that this off-the-top-of-my-head, untested code is a solution that works 100% :) Many thanks!

    Andreas Lloyd


    This is exactly what I’m looking for, too! But I don’t know how to implement the solution offered by Boone.

    I guess I have to edit the bp-activity-subscription-functions.php and add the new function, but I don’t know how to make sure that the new function takes the place of the old.

    Any help would be most appreciated!



    I don’t think he is saying to edit core files … you should never do that if you can avoid it!

    I would try putting it in functions.php in your theme or child theme directory. Or in a bp-custom.php file in your plugins directory…

    If you don’t have either then use a text editor to create one. Start the file with “ – nothing should go before the start or after the end tags. Put the above code in the middle.

    I don’t use the plugin myself though….

    Andreas Lloyd


    Hi Aces,
    thanks for your reply. It makes good sense not to mess directly with the plugin files but rather add it to the bp-custom.php file. I’ll try that out and see how it works.

    I was just wondering whether it is enough to simply add the code or whether I would need to make the plugin aware of the new function in some way. Any advice regarding this would still be most appreciated.


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Confused and confusing email notifications’ is closed to new replies.
Skip to toolbar