Support » Plugin: BuddyPress Group Email Subscription » Deleted posts are included in digests

  • Resolved naomir


    Hi @boonebgorges,

    Thank you for this plugin, it’s really helpful. We’ve been using it successfully in production for some time.

    Recently someone created a topic and then deleted it, but the topic still appeared in the weekly digest.

    Looking at the code, it seems to me that when a topic is created, it is added to the gcawp_bpges_queued_items table, but when the topic is deleted, it is not removed from the table.

    Am I right about that? If so, I would like to add the code myself. I would add a function hooking into when a topic is deleted, and removing the associated activity id from the table.

    I would like to hear your thoughts about this however, before I start.



Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Boone Gorges


    Hi @naomir – Thanks for your interest!

    Yes, this sounds like a fine idea. I’m somewhat surprised to hear that this doesn’t happen automatically, as there’s code in BPGES that causes queued items to be deleted when the corresponding activity item is deleted. It must be the case that bbPress doesn’t clean up its activity items after deletion.

    Here’s the code in question: You should be able to hook into topic deletion, use the topic information to look up the corresponding BP activity ID, and then either (a) delete the activity items (which ought to delete the BPGES queued items) or (b) use BPGES’s bulk_delete() directly.

    If you get a working version, please feel free to send a pull request to the GitHub repo.

    @boonebgorges Thanks & yes I’ve just confirmed your suspicion. When you delete a topic via the GUI, it gets removed from wp_bp_posts but the corresponding activity still remains in wp_bp_activity. That may be a bug in BP or it may be intentional, and some users might rely on it. So I don’t think I will do option (a) and delete the activity. I will go with option (b) and just delete the BPGES queued items. I’ll let you know how I get on.



    Plugin Author r-a-y


    @naomir – You mentioned that when you trash a forum post that it doesn’t remove the corresponding activity entry.

    I cannot duplicate this issue on the latest versions of WordPress, BuddyPress and bbPress. I trashed a forum post from the group forum thread and the corresponding activity entry was removed from the group activity stream.

    Are you doing anything different? Are you able to replicate your problem on a fresh install?



    Hi @r-a-y

    I have the latest versions. I wonder if we are at cross purposes about “trash” vs “delete”.

    That would be my fault, as my original question said “delete” whereas what I actually meant, I realise now, was “trash”. Sorry for the lack of clarity.

    When I trash the topic it remains in the activity stream, but then when I delete it permanently it is removed (I didn’t try that before, but have confirmed it now). This is borne out by the code in bbpress, in includes/extend/buddypress/activity.php. It has

    add_action( 'bbp_delete_topic', array( $this, 'topic_delete'), 10, 1 );

    but no corresponding action for bbp_trash_topic.

    The code I have added to your plugin removes *trashed* posts from the digest, which presumably is desirable?


    • This reply was modified 2 months ago by naomir.
    Plugin Author r-a-y


    @naomir – I cannot duplicate your issue when trashing a forum post.

    The trash link contains the following URL parameters:

    When you click on the “Trash” link, this is the debug backtrace:

    require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, bbp_template_redirect, do_action('bbp_template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, bbp_get_request, do_action('bbp_get_request'), WP_Hook->do_action, WP_Hook->apply_filters, bbp_toggle_reply_handler, bbp_toggle_reply, wp_trash_post, wp_update_post, wp_insert_post, do_action('edit_post'), WP_Hook->do_action, WP_Hook->apply_filters, BBP_BuddyPress_Activity->reply_update, BBP_BuddyPress_Activity->reply_delete, bp_activity_delete, BP_Activity_Activity::delete

    As you can see wp_trash_post() is called and that triggers the 'edit_post' action hook, which bbPress uses to delete the activity item.

    I can confirm that the activity item is removed.

    Tested on WP 5.4.1, BuddyPress 6.0 and bbPress 2.6.4.

    Are you able to list your steps to duplicate your problem? Or are you able to duplicate your problem on a fresh install?

    Plugin Author r-a-y


    @naomir – Do you have “Allow topic and reply revision logging” disabled under “Settings > Forums” in the admin dashboard?

    If that setting is disabled, I can see that the delete routine will not fire:

    There is a similar bug in bbPress that I’ve written a patch, which might fix your problem:

    Let me know if that works for you. (Sorry, this probably will not work!)

    Update – Maybe you can try re-enabling revisions temporarily to see if that works or not?

    • This reply was modified 1 month, 3 weeks ago by r-a-y. Reason: Updated info


    Hello, sorry it took me a while to get round to this, I missed the post about the revisions setting but I tested on a fresh install and it does work, i.e.trashed posts are removed from digest as desired, so I agree my changes are not needed. Thanks for your help

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.