Hi everybody,

I am using FriendList and Heartbeat. I would like to be able to show the activities of the friends of the logged-in user via views.

Another way of saying is that, I would like to be able to create a relationship between: heartbeat table "heartbeat_activity" AND the friendList table "friendlist_relations".

TIA,
Kayra.

Comments

Stalski’s picture

Status: Active » Fixed

You could easily do that with a hook_views_data where you set a relation ship.
but heartbeat connectedHeartbeat does exactly the samen thing, but gives other modules the chance to define "friend relations" as well ... This is done by checking the logged in user id and a calculation of its friends with the hook_heartbeat_relational_uids .
so if you use views, the only thing you have to do is choosing the filter heartbeat:connectedheartbeat and it should work.

thekayra’s picture

Thanks for the quick feedback Stalski.

Unfortunately, I am unable to understand the method related to the filter "heartbeat:connectedheartbeat" that you have suggested.

  1. I could not find the filter on the dev version . The closest is "Heartbeat relational activity". And I could not make it work. Always zero rows.
  2. I found a filter called "Heartbeat user access: friendlist, og, ... connected or related" and I feel like you are mean this one.

If you mean the 2nd option, then it seems like it is trying to set who has access to the activities logged. Bu what I need is something like this:

UserA is following UserB and UserC

Normal activity stream is:

  • UserA added Node1
  • UserB added Node2
  • UserB added Node3
  • UserC added Node4
  • UserD added Node5
  • UserE added Node6
  • UserC added Node7

What I want to see in the view when UserA is logged-in:

  • UserB added Node2
  • UserB added Node3
  • UserC added Node4
  • UserC added Node7

Is it really easy to do with the views and I can't seem to find it or I was not very clear when I asked my question? If former than I would be very glad if you could tell me a little more in detail where I can find that filter =).

Thanks again,
Kayra.

thekayra’s picture

Status: Fixed » Active

I am just changing this to active to get your attention Stalski. I hope it will not be "frowned upon" =).

tobiassjosten’s picture

Does FriendList provide Views filtering on 'users' table? If so, then my patch for #650352 might fix this for you.

Stalski’s picture

Ok, I will reply to this as well.

People who are looking for a stream with activity from your friends (with friendlist or even flag_friend, user_relation, ...), Then this is the best sollution and the sollution I intended:

Default heartbeat comes with 3 streams : publicheartbeat, privateheartbeat and connectedheartbeat

Connectedheartbeat is a stream where the actor is the logged-in user OR one of his friends. These friends are calculated with a hook_heartbeat_related_uids. The other uids are saved in the user object. With this approach you only have the messages you want.

Another aproach is the publicheartbeat with a heartbeat_messages_alter hook that unsets messages from users that are not in your friendlist ... calculate this customly for instance.

I hope i helped you guys with this. I always use the public and the connected and it seems to work just fine. The only problem is that implementors often want to use the views module, but it is not that powerfull for heartbeat streams. (I am NOT saying views is not powerfull, i am a big fan myself). I am only saying a lot of heartbeat nice features can never work with views.

Hint: Look at the heartbeat_example submodule to see what you can achieve with code. My goal is still to display all the things facebook is so good at.
To be continued.

Friendly regards
Stalski

Stalski’s picture

Assigned: Unassigned » Stalski
Status: Active » Closed (fixed)

I will close this as it is in fact perfectly possible what you desire, but i can image the documentation is not sufficient for all users.
I see this issue as a duplicate on the documentation provision issue. I am working on this a lot by an extra submodule, heartbeat_example.
This type of use cases, i will try to cover at the documentation and demo site http://heartbeat.menhireffect.be/

I can only say (if you haven't figured it out by my previous post of course) , follow the project page and i will update the brief docu and entries to further documentation there ...