Advertisement
Naijaping

block activity type buddypress or bbpress

Apr 24th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. /* paste in the functions.php of your active theme */
  2.  
  3. function wudaa_activivity_dont_save( $activity_object ) {
  4. // friendship_created is fired when a member accepts a friend request
  5. // joined_group is fired when a member joins a group.
  6. $exclude = array( 'friendship_created', 'joined_group');
  7.  
  8. // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
  9. if( in_array( $activity_object->type, $exclude ) )
  10. $activity_object->type = false;
  11.  
  12. }
  13.  
  14. add_action('bp_activity_before_save', 'wudaa_activivity_dont_save', 10, 1 );
  15.  
  16.  
  17.  
  18.  
  19.  
  20. // Filter bbPress from updating activity stream
  21. function mulito_activity_dont_save( $activity_object ) {
  22. $exclude = array( 'bbp_topic_create', 'bbp_reply_create');
  23.  
  24. // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
  25. if( in_array( $activity_object->type, $exclude ) )
  26. $activity_object->type = false;
  27.  
  28. }
  29.  
  30. add_action('bp_activity_before_save', 'mulito_activity_dont_save', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement