Last time I explored the log message system was when I was doing activity type viewing with Rules and buddylist2 in Drupal 5. As I remember, you are not able to display content related information the way Facebook does. Has that changed?

For example in Facebook when someone changes their user picture a small thumb of the new picture is shown likewise uploaded videos will display as a playable mini-thumb as well as photo thumbs are shown in the activity steam. Can this be done with Heartbeat? For example could it be as powerful for the log to make a relationship with the nid and pull in teaser informartion through views?

Maybe it is like this already...I'm not sure. Would love to hear your thoughts on this.

Greetz from Holland,

Marius

PS. If this is not feasible at all, could it support log-type class names in the list? This in order to create icons to represent the type of log message, e.g., a relationship log, comment log, content log, login log, og log. Than at least you can create some visual styling to the heartbeat listing.

Comments

Stalski’s picture

Assigned: Unassigned » Stalski

Hey,

Sorry for the late answer.
This is certainly possible as i did all what you indicated in a site I worked on at work. I really have to document everything because it can get a bit complicated.

When you build a heartbeatmessage, you can use html tags in it. Everything should be handled fine. I uses somethings like:
<span class="user">!username</span> posted !title.
On how to show user images or avatar changes, is a bit more comlicated. For this you have to make a token yourself using the token hooks. I will give you an excerpt of code i used successfully.

function heartbeatrules_token_list($type = 'all') {
  $tokens = array();
  if ($type == 'node') {
    $tokens['node']['type-image-url'] = t("The url of the image content type image");
    $tokens['node']['type-image-link'] = t("The image of the image content type with a link to it"); 
    $tokens['node']['type-album-url'] = t("The url of the album content type");
    $tokens['node']['type-album-link'] = t("The image of the album content type with a link to it");    
    $tokens['node']['type-image-album-link'] = t("A link to the album of the uploaded image");
  }
  return $tokens;
}
/**
 * Implementation of hook_token_values().
 */
function heartbeatrules_token_values($type, $object = NULL, $options = array()) {  
  $values = array();
  global $base_url;
  switch ($type) {
    case 'node':
    	if($object->type == 'image') {
	    	// image are shown with a known preset : avatar_60x60
	      if(!empty($object->images['thumbnail'])) {
	        $values['type-image-url'] =  url($object->images['thumbnail']);
	        $thumb = theme('imagecache', 'avatar_60x60', $object->images['thumbnail'], $object->title, $object->title);
	        $values['type-image-link'] = l($thumb,'node/'.$object->nid, array('html' => TRUE), array('attributes'=> array('class'=>'beat-content')));
	        if(!empty($object->field_albumref[0]['nid'])) {
            $album_nid = $object->field_albumref[0]['nid'];
            $album_link = $object->field_albumref[0]['view'];	          
	        }
	        else if(!empty($object->field_useralbumref[0]['nid'])) {
            $album_nid = $object->field_useralbumref[0]['nid'];
            $album_link = $object->field_useralbumref[0]['view'];    
	        }
	        $values['type-image-album-link'] = $album_link;
	      }
	      else {
	        $values['type-image-link'] = $values['type-image-url'] = $values['type-image-album-link'] ='';
	      }
    	}
    	else if ($object->type == 'album') {
	    	if(isset($object->field_image[0]['filepath'])) {
	        $values['type-album-url'] =  url($object->field_image[0]['filepath']);
	        $thumb = theme('imagecache', 'avatar_60x60', $object->field_image[0]['filepath'], $object->title, $object->title);
	        $values['type-album-link'] = l($thumb,'node/'.$object->nid, array('html' => TRUE), array('attributes'=> array('class'=>'beat-content')));      
	      }
	      else {
	        $values['type-album-link'] = $values['type-album-url'] = '';
	      }
    	}
      break;
  }
  return $values;
}

As you can see, I used the image_cache module and a gallery module. I handled this project-specific and is rather difficult to bring into the heartbeat code. For the video and vid-thumb , be my guest and try it out. With the rules and token approach, we are limited to the the hooks i gave an example of.
Heartbeat just uses a trick of own variables that are assigned to tokens (by users of this module) and making it free for us to handle specific project needs.
I hope i helped you with this.

Stalski’s picture

Status: Active » Closed (fixed)
mariusooms’s picture

Absolutely...will give it a whirl when I get a chance.

Regards,

Marius