Skip to:
Content
Pages
Categories
Search
Top
Bottom

I’m working on the activity stream, need help!

  • @aaron-nall

    Participant

    Hello,

    I’m using WP 3.4.2 and BP 1.6.1
    I want to make the activity stream exclude everything but myself and friends.
    I know this was already done in another plugin but I want to do it myself and then add it to my BPs core.
    I know it’s not recommended to mod core files but humor me please.
    What functions, hooks or filters do I need to be working with?

    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • @raminjan

    Participant

    i would say just wait for release of bp 1.7 since I heard from developers that they are going to include that feature of privacy.

    @modemlooper

    Moderator

    There is no activity privacy feature in 1.7. Google friends only activity stream. I think a plugin already exists. You can look through plugin as an example of code

    @drill_sgtlewis

    Participant

    There was a plugin but its gone now! It was removed from the repository. So I guess there is no one that can assist you.

    @modemlooper

    Moderator

    Not too difficult. You can filter activity stream by passing a comma seperated list of user id’s. just get logged in users friends id’s. read the codex on how to filter loops

    @drill_sgtlewis

    Participant

    @modemlooper that is a daunting task when an admin has thousands of users. There should be a more automated way to accomplish this feat than manually doing all that. If that is what it takes then it will take a long long time to get the result your after and every time a a new user joins your site you will have to manually add their id again. That is just not logical!

    @modemlooper

    Moderator

    You get user id’s with code not manually.

    `bp_get_friend_ids( bp_loggedin_user_id() ) ; `

    @drill_sgtlewis

    Participant

    Could you explain this method further because I can see your calling a function but does this function already exist or does it need to be created before calling it? Where would this call be placed? Just curious?

    @hnla

    Participant

    A search of the core files would find you this function!

    bp-friends-template.php

    function returns false if user id passed to it produces zero friends else a comma separated list of id’s is returned thus you have you necessary list to pass to the loop.

    As for where used that would be somewhere where you could use the result in the loop ones writing wouldn’t it?

    @aaron-nall

    Participant

    so after I get the loggin user’s friend IDs then I loop through that array
    but, how do I ask for posts by id? I can’t find it in the codex.

    @hnla

    Participant

    https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    You’ll probably need to work something using the primary_id & secondary_id, but think you are going to be limited in what degree of control you can get.

    @modemlooper

    Moderator

    `function my_friends_only_activity( $query ) {

    $friends_id = bp_get_friend_ids( bp_loggedin_user_id() ) ;

    $query = ‘&user_id=’ . $friends_id ;

    return $query;
    }
    add_filter( ‘bp_dtheme_ajax_querystring’, ‘my_friends_only_activity’ );`

    @shaunmcmillan

    Participant

    My activity stream isn’t including all the activity on http://www.Drawalot.com. I’ve created both custom posts and regular posts but neither are showing up in the stream. I turned off all the other plugins and switched back to the default buddypress theme but the actity still does’t show up.

    I know I should probably make a separate forum topic, but somehow that feature has disappeared for me on this site. I can’t even make status updates. What’s up with buddypress.org?

    @modemlooper

    Moderator

    look at the record activity function http://pastebin.com/kNqTrRzc

    @shaunmcmillan

    Participant

    I already had some code registering my custom post types, but I did copy and paste his record_activity code into my functions.php. I made all, of the necessary edits, for instance I changed the name his post type to the name of my post type. At first it didn’t appear to have made any difference, but then I created a new post type to test it out and it appears in the stream!

    Now I’m going to see if I can include the other post types. Thank you for helping me out.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘I’m working on the activity stream, need help!’ is closed to new replies.
Skip to toolbar