Hello, I am trying to get heartbeat views for groups to display in a block. I am using the instructions found here http://heartbeat.menhireffect.be/docs/how-create-heartbeat-activity-view...
So far, I am having no luck. When viewing the group, I get no results in my block. If I put the block on non-group pages, it returns all of my heartbeat messages.
I feel that I am missing something obvious, but I don't know... Anyhow, I have included my view export if you wish to see it.
Thanks in advance!
$view = new view;
$view->name = 'class_heatbeat';
$view->description = '';
$view->tag = 'Classes';
$view->view_php = '';
$view->base_table = 'heartbeat_activity';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'message_id' => array(
'label' => 'Activity message id',
'required' => 0,
'id' => 'message_id',
'table' => 'heartbeat_activity',
'field' => 'message_id',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'message' => array(
'label' => 'Message',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'message',
'table' => 'heartbeat_activity',
'field' => 'message',
'relationship' => 'none',
),
'timestamp' => array(
'label' => 'Action\'s timestamp',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'heartbeat_activity',
'field' => 'timestamp',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'timestamp' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'timestamp',
'table' => 'heartbeat_activity',
'field' => 'timestamp',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'access_type' => array(
'operator' => '=',
'value' => array(
'access' => 'OgHeartbeat',
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'access_type',
'table' => 'heartbeat_activity',
'field' => 'access_type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('block', 'Class Heatbeat', 'block_1');
$handler->override_option('title', 'Class Activity');
$handler->override_option('empty', 'No activity for this class');
$handler->override_option('empty_format', '1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
Comments
Comment #1
Kirk commentedGood news is, I figured out how to do this. Bad news is, it took a lo of messing around till I figured it out. Basically, I had to create a rule for group content that sets the "Node target Id" to the Group ID when a user submits group content.
I was then able to toss an argument on there to make it work.
A little difficult at first, but I think it's working. I'll try to put together some documentation when I have some time.
Comment #2
Hardrocker commentedWere you able to put a documentation together? I'm struggling to get this feature to work and my client's deadline is past overdue.
Comment #3
Kirk commentedSorry, Hardrocker. I haven't had time to do so yet as I have been busy. Properly documenting this is on my list of things to do as soon as I have time. However, here are the 2 magic components, I hope you know enough to make sense of these.
I am assuming you have set up Rules to record the activities you wish to capture. Once you have your rule, you will want to make sure to set up the "Node Target Id" as seen on your rule config screen. This is the field you need to edit -> http://drupal.org/files/issues/rule-config.jpg
Then, you will go over to your view and add an argument of the type "Heartbeat activity: Node Target". For the argument settings, you will want to set it up like this -> http://drupal.org/files/issues/argument-config.jpg
Brief explanation: The first step is what actually records the OG Context to the activity messages table. The second step just filters the messages to only show those messages that match the group context of the page the user is viewing.
I hope that helps, I'm a little rushed right now.
Comment #4
Hardrocker commentedHi Kirk,
Thanks for the useful bits of info. I have gotten the rules configuration the way you outlined (I would have never guessed that) but I'm stumped with creating the view now. Can you please add a screenshot of your view please if its not too much trouble. Many thanks for your time and patience.
Comment #5
Kirk commentedHere is an export of my view. Should be a little quicker than trying to explain it all. You'll probably need to modify it a bit since this is probably pretty specific to my site.
Comment #6
Hardrocker commentedHi Kirk sorry to be a bother again. I imported the ur views export and it was imported fine. All the fields and settings seems to be in order but the problem still lies where there is no feed for activities within the group context. Do you think there is any settings I may have missed? Please advise and thank you for your time.
Comment #7
Kirk commentedThe view should create a block. You need to then go to the blocks page and place it where you wish.
Comment #8
Hardrocker commentedI have added the block where I wanted it to be. Its still showing "No activity for this class" currently. I don't know what else to look for right now since everything seems to be correct.
Comment #9
Kirk commentedAnd you actually created the message templates and proper rules? If you do that, it should work.
Comment #10
Hardrocker commentedSo I have to create new templates? Can't the default templates work? I have created a rule for when user saves a node and add the target node ID as you mentioned but nothing. I have not created any more rules as yet since I needed to test and ensure one works before adding more.
Comment #11
Hardrocker commentedHey Kirk I am pleased to say that i have gotten it to work now. I have to admit it was quite simple after all. I am going to try and see if i can scribble a documentation and post it in the handbook or something. Thank you once again for your time and patience. Cheers!
Comment #12
Kirk commentedGood to hear! I started working on a pretty in-depth tutorial that I hope to finish soon. But, other projects have been demanding my time.
Comment #13
Hardrocker commentedI know the feeling when it comes to time consumption. I was finally able to finish this client's site and move on with other projects. If u need help with the documentation just let me know. Also one thing I noticed there was no way to add user's pic to the feed. I wonder if the developer plans to add this feature in future releases.
Comment #14
Drake commentedsub
Comment #15
Stalski commentedfirst of all, sorry for the late answer. However I am really pleased to see that an issue of heartbeat got solved by the community ;)
What Kirk says is correct. The node target and user target Id are meant as extra logic parameters such as the required UID and an optional required NID (in node context).
The approach is that posting a node in a group will have the node as Node variable and the group as NodeTarget variable. If someone joins a group for instance, it is enough to set the group id as Node (no need to have it as target).
So when queries are run (for each stream different), the query will look at those node and node target. It's not as clear as I intended it to be (and indeed once you know it, it's plain simple).
About user pictures: in drupal 7 it is built in. For drupal6 you can follow instructions on the demo site as well. There is a good example page to add custom tokens as well (where the token could be an avatar).
This page sums it up: http://heartbeat.menhireffect.be/docs/adding-user-avatar-stream
With heartbeat_ds installed, you should have the same as in drupal7, the avatar as field available.
Comment #16
Hardrocker commentedHey Kirk I seem to be having some problems. Initially the heartbeat OG activities worked but then suddenly it stopped working. All the settings are correct. Not sure what the problems is. Can you advise if any? Thanks in advance.