Skip to:
Content
Pages
Categories
Search
Top
Bottom

Following + own activity

  • Avatar of abyss
    abysshorror
    Member

    @abysshorror

    I managed to have my following’s activities as default but I’d like to add my own (like Twitter does). How could I achieve this ? I’m trying to find where is the plugin filtering the activity to display.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of abyss
    abysshorror
    Member

    @abysshorror

    I reply to myself. I don’t know if it’s the most ortodox way (I’m sure it’s not) but it works :)

    In /_inc/bp-follow-hooks.php, function bp_follow_add_activity_scope_filter:
    `$following_ids = bp_get_following_ids( array( ‘user_id’ => $user_id ) );
    $following_ids = $following_ids . “,” . $user_id;
    `

    BTW, I still don’t know why BP is using strings instead of array of integers for handling user IDs.

    Hope it helps someone too.

    Avatar of mrjarbenne
    mrjarbenne
    Participant

    @mrjarbenne

    This might help you out: http://buddydev.com/buddypress/facebook-style-activity-commenting-with-buddypress/

    How did you manage to get the Activity Stream to default to Followers @abysshorror ?

    Avatar of abyss
    abysshorror
    Member

    @abysshorror

    Hey, thanks for answering ! it’s really hard to get someone to answer around here, specially this days :)

    To get the activity stream default to their followers I used this:

    http://wpmu.org/daily-tip-how-to-set-buddypress-profiles-as-the-hompepage-for-logged-in-users/

    And changed the code a bit:

    `function bp_profile_homepage()
    {
    global $bp;
    if(is_user_logged_in() && bp_is_front_page())
    {
    wp_redirect( $bp->loggedin_user->domain . ‘activity/following’ );
    }
    }
    `

    If you are still having problems, ping me !

    Avatar of smoothkush
    smoothkush
    Participant

    @smoothkush

    This solution solved it for me –

    This goes in activity/index.php ( You can also use it anywhere you are using if ( bp_has_activities…. )

    <?php
    //best practice is to create a function in another file, but this will work…
    $friends = bp_follow_get_following( ‘&user_id=’ . bp_loggedin_user_id() );
    $friends[] = bp_loggedin_user_id();
    $friends_and_me = implode( ‘,’, (array) $friends );
    $friends_and_me = ‘&user_id=’ . $friends_and_me;
    ?>

    After that paste this code

    <?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) . $friends_and_me .’&object=groups,friends,status,blogs’) ) : ?>

    Note : I am using buddypress follower plugins. If you are not using the plugin, you need to change this line of code
    – ‘$friends = bp_follow_get_following( ‘&user_id=’ . bp_loggedin_user_id() );’

    to this

    – ‘$friends = friends_get_friend_user_ids( $user_id );’

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

You must be logged in to reply to this topic.