Skip to:
Content
Pages
Categories
Search
Top
Bottom

filter activity general, activity profile and activity group


  • caniggiaroby
    Participant

    @caniggiaroby

    Hi, escuse my bad english, i’m a php programmer and i must filter all the activity.

    in functions.php i’ve created:

    function bp_activities_include_activity_types( $retval ) {

    // in this function i control if the request is activity general, profile or gruoup

    if(bp_is_user_activity()){
    $retval[‘scope’] = array(
    ‘just-me’,
    ‘friends’,
    //’favorites’,
    //’following’,
    //’mentions’
    );

    $retval[‘object’] = array(
    ‘groups’,
    ‘friends’,
    ‘profile’,
    ‘status’,
    ‘blogs’
    );

    $retval[‘action’] = array(
    ‘activity_coupon’, //my personal activity
    ‘activity_comment’,
    ‘activity_liked’,
    ‘activity_update’,
    ##’blogpost_liked’,
    ##’bp_album_picture’,
    ‘created_group’,
    ‘friendship_created’,
    ‘joined_group’,
    ‘mpp_media_upload’,
    ## ‘new_avatar’,
    ## ‘updated_profile’
    );

    }else if(bp_is_group_activity()){ ## or group

    ## select specified scope object and action
    $retval[‘scope’] = array(‘……’);
    $retval[‘object’] = array(‘……’);
    $retval[‘action’] = array(‘……’);

    }else{ ## or activity general

    ## select specified scope object and action
    $retval[‘scope’] = array(‘……’);
    $retval[‘object’] = array(‘……’);
    $retval[‘action’] = array(‘……’);

    };

    }

    add_filter( ‘bp_before_has_activities_parse_args’, ‘bp_activities_include_activity_types’ );

    I ask if this method is correct, and if is correct in specified menu drop down i can remove the single item

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

  • shanebp
    Moderator

    @shanebp

    Please use the code button when posting code.

    Regardless of what you are trying to do – a function hooked to a filter must return something.

    So your function should end like this:

         return $retval;
    } 

    caniggiaroby
    Participant

    @caniggiaroby

    For this example, i want show in activity user only user’s post, not the user’s post group, i can?

    Example (4 posts):

    A = Is a post created by me in my user’s profile activity
    B = Is a post created by me in my group
    C = Is a post created by my friend Paul in his profile activity
    D = Is a post created by Jean (not my friend, but friend’s Paul) in his profile activity

    Now, i want this:

    In my profile activity i must look: A
    In general activity i must look: A, C
    In my group activity i must look: B
    Paul in his profile activity must look: C
    Paul In his general activity i must look: A, C, D
    Jean in his profile activity must look: D
    Jean In his general activity i must look: C, D

    Do you know? how i can resolved this problem with the filter?


    caniggiaroby
    Participant

    @caniggiaroby

    yes, i’ve this

    return $retval;

    but i have not write in my example, but exist.

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