Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to save deleted activity?

  • @mareck

    Participant

    I’m looking for options to save off deleted activity so that I can keep it as history. It doesn’t need to be accessible via the application, just as long as it is in the database so I can get to it if necessary. I am thinking that I could save all activity to a separate table when users post it or I can just save the “deleted” items when the user performs a delete. Any thoughts on how to accomplish either of these? Any other ideas?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • @r-a-y

    Keymaster

    Check out the bp_activity_action_delete_activity() function in bp-activity.php.

    There’s a hook where you can grab the activity ID before it’s deleted:
    `/* Call the action before the delete so plugins can still fetch information about it */
    do_action( ‘bp_activity_action_delete_activity’, $activity_id, $activity->user_id );`

    You could potentially archive this information into a separate table for your own usage.

    If you’re not familiar with WordPress hooks, check out the Plugin API codex page:
    https://codex.wordpress.org/Plugin_API

    @mareck

    Participant

    Thanks! This pointed me in the right direction. I see there is also a bp_activity_after_save hook that I might use to get a complete copy of all activity up front. I’m weighing those two options to see what works best for me.

    @mcarrano

    Member

    @mareck

    Can you share more details on your implementation? I am looking to do the same thing for my website. Ideally, I would like all information (activity stream, group information, etc) to be “soft” deleted. As in, it is deleted in the eyes of the user but still stored in the database.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to save deleted activity?’ is closed to new replies.
Skip to toolbar