Skip to:

Filtering Activity Feed

  • groston


    I would like to prevent certain types of activities from appearing in the global feed. I have found a number of articles that discuss this, but many are quite old (prior versions) and (to a novice), many seem to be incomplete.

    Based on my reading, it seems that the clean way to do this is to add some code to the file functions.php in themes/child-theme. Based on my reading, and just for testing purposes, I added the following code:

    function ec_filter_activity( $activity_object ) {
      $activity_object['action'] = array( 'activity_comment' , 'activity_update');
      $activity_object['per_page'] = 8;
      return $activity_object;
    add_action( 'bp_after_has_activities_parse_args', 'ec_filter_activity');

    However, when I reloaded the page with the activity feed, the following appeared in debug.log:

    PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘ec_filter_activity’ not found or invalid function name in /var/www/html/wp-includes/class-wp-hook.php on line 286

    Can you please help me figure out what I am doing wrong. I suspect that if I can get past this error, I can make the filtering work…


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