Activity

Last modified: September 24, 2009 - 07:40

There is also an Activity group with some documentation strewn throughout.

The Activity module keeps track of the things people do on your site and provides mini-feeds of these activities in blocks, in a specialized table, and via RSS. The module is extensible so that any other module can integrate with it. The messages that are produced are customizable via the admin interface and are context sensitive. Some theoretical example messages include:

  • You wrote a comment in response to "example comment title"
  • Jim wants to be your friend. Approve this friendship here
  • Nancy is Phil's latest fan

Features

  • Lets you list all the activities in the site which can be viewed by all the members with permission
  • Integrates with Buddylist and Voting activity
  • Enables to view only your activities from a separate tab

Installation and setup

  • Download the latest recommended version from http://drupal.org/project/activity
  • Unzip and copy the folder activity where you have kept other modules
  • Log in as admin and come to admin/build/modules
  • Make sure you have the modules node, comments enabled and proper permissions granted to users. Along with this if you have Buddylist and voting activity installed these activities will also be logged by activity
  • Enable Activity and enable at least Activity history, Buddylist activity, Comment activity, Node Activity
  • Now come to admin/user/access and select the check boxes for 'view own activity' and 'view public activity' for authenticated users (and any other roles you may have in your site)
  • Now come to admin/settings/activity and click on each of the tokens to fill up the forms with languages of your choice - SAVE THESE FORMS AT LEAST ONCE TO ACTIVATE THE ACTIVITY LIST

Activity adds excitement and fun to your social site

The main activity tab can be named as site spy if you want. The languages in the listings can be as fun or as amazing as you can imagine. For example:

- User X and user Y just decided to stay together
- User Z expressed "Oh ! I do not understand modern art"
- "Code the node" - Hey! This blog exists no more
- "Is Mountain better than sea?" - Hot debate starts 1 min 7 sec ago

[page 1,2 ...]

What works in background for the above

- User X and user Y just decided to stay together [Buddylist activity]
- User Z expressed "Oh ! I do not understand modern art" [ Comment activity]
- "Code the node" - Hey! This blog exists no more [ Delete recorded by Node activity]
- "Is Mountain better than sea?" - Hot debate starts 1 min 7 sec ago [ A forum node recorded by Node activity]

You can also spice up the list with small icons to precede each line of the activity listing by separate icons for each of the various activity eg. blog, buddy, forum so on. This looks really very cool !

Show small icons

lelizondob - November 2, 2008 - 19:48

To show small icons on each line you just have to override the theme_activity function in template.php with something like this:

function theme_activity($message, $item) {  
  return '<span class="' . $item['type'] .'">'. $message . '</span>';
}

Then with css you can do something like this:

span.blog {
background: url(images/blogicon.png) no-repeat;
padding-left: 20px;
}

You can also add more detail, like the operation being performed, like insert update or delete, so you could even have blog_insert or blog_delete instead of just blog, this will give you a span class more personalized to add more icons.

More info on http://drupal.org/node/323380

can also be done via the administrative interface

minesota - November 2, 2008 - 23:32

I do not know if this is the recommended or suitable way or not but I avoided touching any of the files (which perhaps has some advantage) and just do it via the administrative interface.

Just an example :

come to /admin/settings/activity

click Tokens for nodeactivity

click on Messages visible to the "All" role.

come to Blog entry: Create:

Fill the box with something like

<image align=absmiddle src=whatever_path/whatever.gif> [author] penned  [node-title-link]  [time-ago] ago

I think with some conditional statement in tpl files like "if [time-ago] is in seconds" there can be a lot of fun, for example if a blog has been deleted 5 secs ago, one can show an animated trash icon which later becomes a static one.
On special days eg. valentines day you can simply change some (or all) icons with the valentine versions of the every-day icons easily via the admin interface instead of having to edit files and then ftp those.

In fact, apart from APK, album, buddylist, OG the module activity seems to be the best part of social drupal (thanks jaydub) and have immense possibilities of doing many novel things (not yet done by facebook or any other) unlimited by code, limited by imagination.

 
 

Drupal is a registered trademark of Dries Buytaert.