While I am familiar with og_activity, I was hoping that it would track activity by group so that I could display each group's activity individually. I am not sure if this will be present in the 6.x-2.x branch of this project, but I went ahead and implemented it in 6.x-1.2 as kind of a proof of concept. There are a number of potential problems with my code.
First, I wanted to wholly incorporate this into ogactivity, however within the central activity_insert function is the best place to detect and store group ID. It's not just group events that need to be tracked by group, but node, comment, and other activity as well. Putting this logic within the base activity module's activity_insert function makes it work with any group content - as long as a group context is present. There may be a better way of doing this though.
Second, I didn't use the 'data' field in the activity table to store the group id for the event. I wanted to be able to filter by group id with activity_get_activity, so a new column was needed within the activity table. This may be best handled with a new table, however I skipped having to use a JOIN this way.
Finally, I added 2 blocks to the hook_block in activity - one is a summary of per-group activity and the other is a detailed, table view of per-group activity. In all cases the OG API function og_get_group_context() is used.
I did try to detect the presence of OG module and only enable these features if it was present.
So, if anyone is interested in incorporating this into any branch of Activity module, please feel free to advise how I might improve the code, or better section it into appropriate contrib modules. I've been testing this and it seems stable so far.
I am not a pro with diff, and this diff is between activity-orig/ directory and my new, modified activity/ directory. If there's a better way to diff this please let me know. Patch is attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | activity-539048.patch | 11.7 KB | msielski |
| #2 | activity6.x-1.2-gid-support.patch | 4.5 KB | msielski |
| #1 | activity6.x-1.2-gid-support.patch | 4.25 KB | msielski |
| activity6.x-1.2-gid-support.patch | 5.2 KB | msielski |
Comments
Comment #1
msielskiCleaned up the patch, there were some redundant lines in the first one.
Comment #2
msielskiMy code did not handle inserting the NULL in the database properly, and now does. Also, the events triggered by ogactivity do not have group context so some extra logic was added to determine the gid in that case.
Comment #3
Ghostthinker commentedSo is this commited to dev?
Comment #4
ekes commentedThe patch seems to be reversed. Also could you make it like http://drupal.org/patch/create so it makes it easier to read what the context (either side of the changes) are. I'm just trying to test it out here, it would be really cool to get it working.
Comment #5
msielskiThanks for the feedback - I'm not too familiar with patching but I was able to follow the steps and generate this patch using CVS against the activity module with a versiontag of DRUPAL-6--1-2 (which is what I originally wrote it against). The patch is attached.
Comment #6
sirkitree commentedclosing. 1.x no longer supported.