Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filter bp_has_activities() by &inlcude=id but not its comments


  • danbrellis
    Participant

    @danbrellis

    I am successfully filtering bp_has_activities() with this function

    
    function mod_exclude_pending_activity ( $query_string, $object, $filter, $scope, $page, $search_terms, $extras ) {
    global $bp, $activities_template;
    
    $group = $bp->groups->current_group->id;
    
    if ( $object != 'activity' )
    return $query_string;
    
    $ids = mod_get_published_ids ($group); //return a comma separated list of ids
    
    $query_string .= "&include=" . $ids;
    
    return $query_string;
    }
    add_filter( 'bp_dtheme_ajax_querystring', 'mod_exclude_pending_activity', 1, 7 );
    

    So this will only include activities with the ids that I include, which is what I what.

    The problem is that it displays all comments on any activity (if hat activity’s id is in the include list) even if the comment’s id isn’t one of those included. Not sure what to do, I’ve searched through all the forums, and docs with no luck.

    For example, when I var_dump $query_string I get “&include=147,148,149”. These have type activity_update, but in the activity stream the comments of those are displayed, even though their ids are not in the list I called.

    Any help please?!?! It would be very much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbrellis
    Participant

    @danbrellis

    Anyone have any ideas on this? Thanks!


    danbrellis
    Participant

    @danbrellis

    Okay, so I’ve sort of abandoned this method and have been trying to figure out the bp_has_activities filter. It seems the ‘current documentation’ (https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/) is actually outdated because there is no mention of an exclude parameter which was indeed added to buddypress 1.5!

    I need to modify the activity stream and exclude all updates and comments if they have a specific meta. I can get a list of ids to include or exclude, but I’m lost at how to appropriately apply the filter from within a plugin.

    Again, I’d really appreciate the help. I’m having an impossible time finding current discussions or docs for the bp_has_activities filter for buddypress 1.5.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter bp_has_activities() by &inlcude=id but not its comments’ is closed to new replies.
Skip to toolbar