[buddypress-trac] [BuddyPress Trac] #5333: new_blog_post activity items not deleted when blog post is deleted

buddypress-trac noreply at wordpress.org
Mon Jan 13 18:32:04 UTC 2014


#5333: new_blog_post activity items not deleted when blog post is deleted
--------------------------+--------------------
 Reporter:  henry.wright  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.0
Component:  Activity      |     Version:  1.9.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+--------------------

Comment (by henry.wright):

 Hide

 {{{
 function hide_activity_item( $postid ) {

     $args = array(
         'user_id'           => bp_loggedin_user_id(),
         'type'              => 'new_blog_post',
         'secondary_item_id' => $postid
     );
     $activity_id = bp_activity_get_activity_id( $args );

     bp_activity_add( array(
         'id'                => $activity_id,
         'hide_sitewide'     => true
 ) );
 }
 add_action( 'trashed_post', 'hide_activity_item' );
 }}}

 And show

 {{{
 function show_activity_item( $postid ) {

     $args = array(
         'user_id'           => bp_loggedin_user_id(),
         'type'              => 'new_blog_post',
         'secondary_item_id' => $postid
     );
     $activity_id = bp_activity_get_activity_id( $args );

     bp_activity_add( array(
         'id'                => $activity_id,
         'hide_sitewide'     => false
 ) );
 }
 add_action( 'untrashed_post', 'show_activity_item' );
 }}}

 Notes:

 1. I haven't tested this bit I'm hoping it illustrates my thoughts.
 2. This would only work for the sitewide stream. Is there a
 {{{hide_user_stream}}} param?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5333#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list