I need to have an update journal of various actions for my site. However, as far as I reviewed the Activity module, it shows a sequence of single items, e.g.:
- John Doe commented on ABC
- Mary Ann commented on ABC
- Bill Gates posted blog XYZ
- Steve Jobs uploaded gallery ABC
etc.
I find that rather messy; furthermore I think people are used to a Facebook-like stream where all uer activites are grouped together as so called "stories" which can be commented and flagged with a "like"-button.
Now the perfect equivalent for these "story" type in Drupal would be nodes/content types. So I would like to display my Activity stream as followed:
- Steve Jobs uploaded gallery ABC
--- John Doe commented on ABC
--- Mary Ann commented on ABC
- Bill Gates posted blog XYZ
So my question is: How far is that possible?
1st, I thought about doing it the other way: Just use Views to create a view getting the latest nodes including their comments. Actually, this should work fine and it is just a matter of theming to output a nice grouped layout and I guess Views is the richest module of all so you have control over nearly all fields. However, there is a big disadvantage: Not all modules (in particular the "Facebook-like statuses") do expose their data as nodes. Rather, some create an own view type. But you can create a view only for one view type (e.g. "nodes" OR "whatever"). So either my activity stream would miss some important user activities, or I would have to present different activity boxes (one for node-activites, one for Facebook-statuses, etc.) separately (which I do not want) or somehow merge views of different view types (which I think is rather messy or not possible et all).
So, I am coming back to the Activity module and asking if it is possible to output the activities grouped by nodes (as described above) and how far I can theme it using the following fields:
- Picture, name, custom fields of the node-author
- Node title and excerpt
- Publishing date
- Comments inlcuding picture, name, custom fields of commentor and the comment itself
If neither using Views nor the Activity module itself does work I was thinking about just querying everything myself from various database tables even though I think it is an approach I should avoid. Anyways, if that is the answer, could you point how and where I should put my custom PHP code at best (e.g. in the template)?
Thanks for your help!
Comments
Comment #1
sirkitree commentedWow, if you spent as much time testing out the module as you do explaining yourself you would probably have the answer along with some bug fixes ;) Just joking, more explanation is better than too little.
To answer, use Activity2. You can separate messages by content type, comment on them, and even use Views to display them. It's totally what you're looking for.
Comment #2
jaochoo commentedThanks for your answer (and reading my long request ;-). I wasn't aware of Activity2 because there is no such module in the listing until I now found out that it is just the 2.x dev of Activity module. So I installed that one instead now and will try it.
After trying it a little bit, I have to say that it looks very promising. However, I have the following questions:
1) Users can comment an activity, but these comments are not the comments for the actual node. E.g. I write a new blog so aactivity with message "John Doe wrote a new blog" will be published and users can comment on it. Once they open the blog I wrote they get a completely different list of comments. I think this is confusing because a user will assume that the comments displayed along with the activity message are the actual comments on the node but then he gets a different list of comments when he views the nodes. So how could I make this the same? I guess I would have to change your code and use the node comments table instead. Or use hooks to sync the comments from node to activity and vice versa?
2) Furthermore, when defining a new Activity Publisher Template I can pick and choose from a nice long list of tokens. However, I do not find the following:
- Author profile picture (I would like to use it together with imagecache module)
- Excerpt/teaser of a node
- Number of comments
- List of comments (including comment author name and picture)
- The name of the profile field a user changed (e.g. "XYZ changed his phone number to: 01-234-5678)
- How to determine the user gender ("his" vs. "her")?
3) After installing Facebook-style statuses I see there is now an "owner message", a "poster message", a "self message" and a "public message". Now what is difference between an "owner", "self" and "poster" of a message and why do these fields not appear in e.g. the node template?
(Side note: There is a link in the module admin which points to http://drupal.org/handbook/activity/developer but that site does not exist.)
Comment #3
jaochoo commentedI changed the version of my issue to 6.x.-2.x-dev as we are talking about Activity2 now.
Comment #4
jaochoo commentedI changed the title of my issue as well.
Comment #5
sirkitree commented1) Duplication/syncing of the comments would be a bit of a waste probably, but probably the easiest to implement.
2) Tokens can be created in a custom module, or you can make them through the cck/token interface. If one is not available, you must find a module that either provides one for you or create one yourself.
3) FBSS: please search the issue queue for the relevant information. I know it's in here somewhere if not in the FBSS queue.
lastly, thank you: the correct link is http://drupal.org/node/328429
Comment #6
jaochoo commentedThanks for your answer.
1) You say it is easy to implement, but a bit of a waste. How do you mean the last? Actually I do not like such because I do not like hacking into working things too much. But in this case I need it for the above mentioned reasons. Can you recommend an easy way to achieve this syncing without hacking into something too much?
2) I did not mean a custom module, but showing the above mentioned tokens for general things (content types, comments, user profiles).
Comment #7
Scott Reynolds commented1.) will not happen. Activity comments != comments for a variety of different reasons that arn't worth hashing out. And I think you would find it more difficult then you think if you had threading for node comments.
2.) will require either user imagecache profile module to implement the token or create a custom module. Activity WILL NOT have this for you. It provides only a few tokens and brings in tokens from other modules.
For grouping of messages you will have to use Views3. And even then you have to be careful as it very will might not display the Activities WITHOUT a nid. (i.e. Facebook style statuses).
Comment #8
Saeh commentedfor 2) i thought there was a problem with images being saved at the point of submission or something, so the user picture doesnt get updated if a user updates the picture.
but the reason im here for was because I search for node/activty comments and found this thread. Seems liks getting the node comments syncing with activity comments is a pretty much impossible idea based on the previous post.
But, is there away activity comments can be used instead of node comments, for example, user/1 creates node/1. then is it possible to create a view, add an argument to only show activity involving the node the view is on, add a filter something like only show the node created templated, and add activity comment form to the view. So the node gets created, the activity gets recorded, theres an activity item with a comment form created on the page at the same time. then on all other views, i.e activity/all it will say admin created node 1, and the same comment form will be on the activity item at activity/all view as the comment form on node/1
Comment #9
Scott Reynolds commentedNot totally true actually. If you create a relationship to the node and then a relationship to the comment table you can. Though, this will probably lead to duplicates.
So yes. Create a View with a relationship to the node then add the nid argument as the argument. Set a filter for the activity type to insert. And you should have it.
Comment #10
Scott Reynolds commented