Closed (fixed)
Project:
Heartbeat
Version:
6.x-4.11
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
3 Aug 2009 at 15:06 UTC
Updated:
3 May 2011 at 21:21 UTC
Jump to comment: Most recent file
Another task I'm going to have in the near future... there is a hint in the release notes it's possible already, but I'm not sure:-
Create a heartbeat for activity in an organic group - including posts to the group etc.
I can't see an obvious way, at the moment. My thinking was just to create a views relationship to do something like join heartbeat_activity to og_ancestry on nid_target to nid and add where group_nid?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | opportunity_heartbeat.txt | 4.9 KB | benoit.borrel |
| #10 | heartbeat_views.views-og-relationship.patch | 592 bytes | benoit.borrel |
Comments
Comment #1
Stalski commentedHey,
Yes, i saw two options to do this.
One was the way you speak off, to indeed use relations OR maybe even better in this context: views filter. Show only where nid_target is a node within group nid (the group node nid).
I think i will implement this in the upcoming two weeks.
Thx for your help!
Stalski
Comment #2
teleted commentedStalski -- thanks for the excellent work on this module!
So, do I understand correctly that displaying heartbeats on a group homepage for just members and content of that group is currently not possible until you modify this module? Or is it possible if I properly set up a view?
Comment #3
ekes commentedMy suggestion was as simple as:-
I'm going to test it out for a bit now - not sure if it should be in hook_views_alter to make sure it gets called if og installed afterwards etc. It makes the relationship, and if you want to filter on a particular group you use the og_views parent group filter from this relation.
If all goes properly I'll post a proper patch.
Comment #4
Stalski commentedTrying out everything, for the moment.
Please have a little more patience.
Comment #5
Stalski commentedThis relation does not what you want i think. a relation between the node posted to a group does not solve the problem of the where nid = the current group, or am I wrong?
could you describe or give me the sql you think would be correct for the organic group logic.
With a custom (or maybe later move to module) heartbeat access state object, it certainly is possible.
Comment #6
ekes commentedNo it won't do anything about changes to the group node itself, be nice to have in addition (although most group sites I've worked with don't actually change the group node itself much). Membership changes would be the thing to add somehow.The above give a query like:-
Thus you only get nodes in the group 190111 from the above.
Comment #7
Stalski commentedYes, indeed. That is if you choose the nid_target to be the "top group node id", isn't it?
I am writing down now all cases that can happen and I must say, it's rather difficult. Well with the grouping in mind ... . I will type it inhere, and if you like to follow my reason and maybe you can help me figure out the correct approach.
First of all: there are two approaches:
With group id
The query to run tries to do something with the top group id, but in this case, heartbeat logs must contain a variable like nid_target to map the top group id too. In this case the grouping will always go bad when grouping on users, because heartbeat can only group 1 variable for the moment (this will be fixed as well, i think).
E.g. "!user updated !article in !group" as single message will have these multipe message variable possibilities:
- %group% will end up showing 1 title by same user in several groups. So here it is difficult, because the titles are different (more grouping variables would be needed).
- %title% will end up showing several titles by same user for 1 group
With users (how heartbeat does things for the moment
The query to run only checks the currently logged in user (OR user from url). public, private and connected. So what can be done here is to make a additional AccessState class OgAccess.
In this case the additional sql would do something like
where $this->_heartbeatInfo->user_relations are all members of the current group node. In this case we fetch content via matching author in stead of trying to work with a match on group nid (heartbeat logs are not aware of that)
I will now type everything out more understandingly ;)
Comment #8
Stalski commentedI am closing this. So it is certainly possible now and there is an example on the demo site in about a week.
I am trying to cover lots of use cases there.
thx for the patch again Ekes
Comment #9
Stalski commentedComment #10
benoit.borrel commentedHi,
I wanted a view which displays a specific group activities, group context being passed as argument via URL. So, I:
But then I noticed the query generated by the view was not joining og_ancestry table properly. It was joining on
heartbeat_activity.nid_target = og_ancestry_heartbeat_activity.nidinstead ofheartbeat_activity.nid = og_ancestry_heartbeat_activity.nid. So I altered views/heartbeat_views.view.inc::heartbeat_views_data() to fix the relationship with OG (patch enclosed).Am I wrong or the relationship was indeed misdefined in heartbeat_views_data()?
Comment #11
benoit.borrel commentedComment #12
rburgundy commentedI think benoit.borrel meant to open this back up for discussion for his patch?
Regards
Comment #13
Stalski commentedCommitted as a double. They both make sense in a way.
Usually the nid is the post and the nid_target is the group (join on nid_target)
But you can add a group, edit the group, join a group where the nid is thus the group (join on nid)
Or both.