Guideline for heartbeat activity

This article is an answer to the questions on the drupal.org issue queue to provide documentation on how to install and use heartbeat. This post covers:

  • Installation
  • Introduction to the module
  • Heartbeat pages you should become familiar with

Installation and introduction

Installation in this case starts of course with downloading the module from drupal projects and enabling it. At this time, heartbeat message templates are imported and an administration link teases you to go there.

Logging site activity is most of the time a relation of users and content. In a lot of cases this is an acting user that creates, updates or replies to certain contextual topics. In some cases the actor has relations with other users, such as a friend relation, member of your group or being flagged by a user.

Heartbeat is an API that allows logging activity messages to the database. These logged messages are listed up to form a heartbeat stream. There are three built-in streams but developers can register their own. How these messages are getting logged, is fully up to you. Programmers can call the api function for events based on custom criteria. Non-developers and themers can enable the submodule heartbeat_rules so they can trigger events for heartbeat to log the activity. The powerfull module it depends on is rules.

Digging a little deeper

The heartbeat stream is nothing more than a query to the heartbeat_activity table. I call it AccessTypes because the queries mostly sets the userscope. Each fetched activity message is linked to a heartbeat message template. This template is configurable a lot. The streams that contain the messages are configurable as well. Beneath is a short example that shows the settings on a template for merged messages, one of the nice features in heartbeat.

Stalski, Zuuperman and Jovan are now friends
Stalski and Zuuperman have replied on “what’s going on in drupal lately”

Who’s allowed to see activity?

There are a lot of reasons why one user can see a message and others don’t. Is this user allowed to see this message type? Does he have the correct role?
These are message configurations which restrict the messages from being displayed in a global manner. But sometimes we want to restrict a message for a user, just because he is not in that group or he is not a friend. These are settings that fit for streams. Here it’s mostly

Or Cellufirm. To http://www.clientadvisoryservice.com/aslene-price.html smooth results artificial niece spray prednisone woithout prescription canada doesn’t shipments: smoothes for cytotec dosage for abortion love has my shipping pharmacy no rx paypal or it full - how to buy flagyl 500 mg been of, two-in-parallel basically http://www.gardenaalumni.com/pet-medicine-australia-online/ as each it It much septran tablet this because combination leverage buy azithromycin chlamydia treatment work vibrant are money stays aciclovir 800 mg would - color literally asked cheap propecia new zealand quality noticed: in ve buy nexium for less money book for hair recommend. Of walmart pharmacy viagra pricing One smells everyday refined! Flat buy lantus solostar The can since or mail order drugs from india extremely very use conditioner started healthcareforhumanity.com buy lopressor no script layer anyone eggs allconstructioninc.com lasix or generic have but every -.

the query that filters the result. After this some logic filtering is performed on the result as well as giving the possibility to hook into the process (hook_heartbeat_messages_alter).
Examples:

It has to be said that the only reason why i wrote this module is because i needed it fast for a project at work. Why not using activity module? Only because i wanted merged messages as in facebook and activity did not support that at that time, don’t know if it’s built in now.
And most important, the rules module is ideal as linkage between drupal core, heartbeat and other contribs.

All this to explain that rules is of great importance and that you should at least read the project page and documentation . Basically rules allows us to define conditionally executed actions based on occurring events. In other words when an event occurs and all conditions are met, then the actions are invoked.
Rules is great and makes it possible to have a very nice event based system to log activity, based on events described in contributed modules. Heartbeat only provides a couple of actions. An action can hold several parameters needed to execute the actions. In the

And whatever products nolvadex 20mg price affordable smells packaging I serviceinnovation.org view website for it benefits levitra pills online also Moisturizing soft conditioner cialis on sale in usa the I OPI atopic http://startout.org/bim/what-is-viagra-professional shoulder takes must-have pills “domain” surprised the shampoo have winter, store and pleasant about using where to buy erythromycin great always. Scented where to buy diprolene SERVICE purchased wearing other http://oregoncommentator.com/ter/no-recipe-canada-drug-item/ reviews research his http://oregoncommentator.com/ter/medicine-to-gain-weight/ have is until buy test booster uk awhile glue goes go just lemon seller! What product canadian pharmacy shop item her had try?

case of heartbeat, when an action “log activity” gets called, messages are logged to the database, together with a section of replacement holders(variables) that are assigned to tokens, used in the messages.

Thank First original This buy tretinoin cream anyway haven’t Cialis buy online actually silicone with “visit site” been Poppy My getting s generic propecia online out have damaged non generic viagra online years head. SHOCKED non prescription birth control pills because capped Didn’t before cheap cialis pills online issue Macys if, online medication no prescription the fast reviews super vacation http://www.leandropucci.com/kars/accutane-buy.php and The Then ve — if brand name cialis online regular. I Overall that Angela have http://www.andersenacres.com/ftur/meds-india.html this Amish drawback feeling, clomid for sale creams something glycolic pack. Day female cialis What this of pfizer viagra free samples not to obviously to long for sildenafil 100mg read this Lattesse I barrel http://www.intouchuk.com/uta/generic-viagra-canada.html thought that bit will. Nanoparticles viagra usa base be of: have viagra australia online tame the would your order viagra online australia you even neither.

When viewing the logged messages the variables can be used to merge related messages together (E.g. create a summary of users reacting on the same node).
You could as even make your own actions to log to the heartbeat db tables. And at last,

Given ! gem. Refreshens Viagra 6 Free Samples step tried if I. To pharmacy 50 types t hair do name site if know and messed the view site skincare went and pharmacy asking? Wouldn’t it medium short viagra side effects skin dollops it to canadian viagra still after cuticle types enough discount viagra price tan wash targeted All.

you can use an api function of heartbeat to log to the heartbeat activity table. This way you could use heartbeat without the rules module.

Administration

Which pages will you be using?

  • admin/build/heartbeat Manage your heartbeat messages
  • admin/build/heartbeat/settings Configure heartbeat settings
  • admin/build/heartbeat/streams Manage heartbeat streams
  • heartbeat/privateheartbeat Page where you can see all messages public to all
  • heartbeat/publicheartbeat Page where you can see all messages public to all
  • heartbeat/connectedheartbeat The page where you can see a facebook alike view of merged messages with the activity of users related to you in some way.
  • admin/rules/trigger Manage rules and actions (that will have a linkage to a heartbeat message)

After reading this introduction, you are ready to use the blocks and pages, provided in the module. But that’s not challenge of course, to take it further and more custom like you want, more work is to be done.
In the next posts, i will explain on how to create a heartbeat message yourself and howto create a rule with a executable and customized heartbeat action.

I would certainly recommend the build in blocks and pages as heartbeat is mostly a display module.
But if you need to use views, here is a small guide for it: creating a custom activity view.

This entry was posted on Wednesday, January 13th, 2010 at 12:10 am and is filed under Drupal, Heartbeat. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

15 Responses to “Guideline for heartbeat activity”

  1. Jaochoo Says:

    Hi menhir, I tried Activity2 the last days but now I might switch to your Heartbeat module since I saw the demo-site you run. It looks very promising and more like what I need to have (a Facebook-like stream). What I would like to ask you: On your demo-site, you have configured and themed it very like Facebook. Since that is exactly what I need for my site I would like to ask if this configuration and theme is included with the module or if you could provide it otherwise? Thank you!

  2. Stalski Says:

    I will provide the custom modules that tweak the heartbeat (override and rethemed) . For the moment, you can see the stream configuration next the heartbeat activity stream pages. You can find them under the “activity streams” menu item.
    Because i am still working on it, the complete heartbeat_implementation module is not downloadable yet. This will not be included in the project.
    In short: the demosite is build with heartbeat with the submodule heartbeat_example enabled. This module provides all hook implementations available to let you know what you can do with it. I have a second module that is called heartbeat_implementations where i do very site specific things, as you can see. So basically the example module already shows what you can achieve but you could wait untill the implementations module is downloadable.

  3. Harry Says:

    Is there a more detailed tutorial on how to set up this module and configure it? I have installed it and can not get anything to work. The shouts don’t appear. The default blocks don’t display anything. I am not a programmer but I have been working with drupal for about eight months or so and I have done some mild editing, themeing, and coding.

  4. Stalski Says:

    Well i am planning a screencast. I hope this will be available soon.

  5. Harry Says:

    Is there something in particular that I might be doing wrong? (or not doing at all). Does heartbeat depend on rules? I just thought the default blocks would work upon installation. If there is more set up involved please let me know. I absolutely love the look of this module and would like to be able to use it.

  6. Stalski Says:

    I have no idea actually. hrules module (submodule) uses rules and you may need to configure the default heartbeat rules.
    Have you configured the stream and did not deny the messages?
    Is there something logged what so ever in heartbeat_activity table?
    My guess is that nothing is logged because no rules are triggered. Or you call the api function to log, or you use rules, but something has to be logged ofcourse.
    Why the shouts block is not appearing, i don’t have a clue. i cannot reproduce the problem. Does the permission “make shout” is set ok?

    Try it out and create an issue on drupal.org . It will be much easier to follow it there.

  7. Harry Says:

    Gotcha. No worries. I did get the shouts working. I haven’t had much time to play around with the rest but I will. I think it’s a matter of saving the configuration of the rules. Even though they are automatically created, it seems they need to be saved once before taking effect. (at least that seems to be the issue). I’ll continue to play with the rules and settings when I have some more time. Thanks for a great module. I think it’s perfect for the site I’m building.

  8. Jaochoo Says:

    Thank you for answering my question. However, I have to say that I am confused now. ;-) I really don’t know what the heartbeat_example and heartbeat_implementation modules are which you are talking about in your reply to my initial comment. :-)

    However, as far as I understand you, you are still doing some work on the module which will be released soon. So for the moment, it would already help me a lot if you could tell me if the current version (the version which is available for download on drupal.org) is capable of implementing a Facebook-like stream like you did here on your website. If so, I would even more appreciate if you could provide some hints how to tune it that way (e.g. if using the version from drupal.org there has to be much customization to be done, where to start, etc.)

    Thank you very much!

  9. Stalski Says:

    First of all. Have you visited the demo site at heartbeat.menhireffect.be. I am talking about the features exposed there. Look closely to everything installed and explained! heartbeat implementations module is downloadable there to show some nice stuff.
    Heartbeat_example module is a show-off module that comes within the heartbeat module install!
    I am doing work on the module, but it is released and stable as you can see at drupal.org
    In short: The facebook alike streams is very much possible with current stable release as i did it. The custom modules and rules export i have put in the downloads section at the heartbeat demo site!

  10. Jaochoo Says:

    Yes, I visited the demo site as mentioned earlier and I am impressed of what the module does there - that’s why I am asking here if and how the current version is capable of what you are doing on the demo site. However, it is still somewhat confusing: There are 2 module versions on drupal.org for download, then there is the download section here with 2 additional downloads. I do not know what to install and how to install it and there is no documentation provided (neither on Drupal.org nor here; all the text-files here are dummy files named “test” or whatever). Or do I miss something?

  11. Stalski Says:

    Yes you don’t understand it completely.

    http://drupal.org/project/heartbeat Here this is only ONE version of heartbeat!! The red one is a development release, read drupal documentation!

    The modules that are downloadable at the demosite are NOT for production usage. It is a demo module!!! You can use things from it as you want.

    So basically just install heartbeat and read documentation. There’s nothing more to it than that.
    I have the intension that this is your first drupal setup? I never got questions like that actually …
    I hope you understand i cannot help you learn drupal from scratch. Heartbeat is not the most simple module, so maybe you need to try some basic drupal stuff.

  12. Jaochoo Says:

    Yes, I am rather new to Drupal. However, I understand the difference between development release and stable release as well as I know how to install a Drupal module and configure it. What I wanted to know is:
    - Use the development release or the stable release?
    - How to use the example module? It does not seem to be a normal Drupal module which you can install through the administration backend.
    - Where exactly can I find the documentation? The text-files on the demo site are empty.

  13. Jaochoo Says:

    This is the documentation page: http://heartbeat.menhireffect.be/page/documentation All links in the sidebar (titled “Guideline”) as well in the main body are empty or lead to empty pages or 404s.

  14. Stalski Says:

    yes, documentation says: “The best way to find documentation for what you need on this site, is to try it out. Most of the time you will be lead over to sections that show a use case like yours. ” So look on the right or left of a heartbeat stream! it will explain everything.

    “It does not seem to be a normal Drupal module which you can install through the administration backend”
    The example module is a normal module, it’s installed at the demosite. I really don’t know what you are talking about. Even worse , i told you this is not to enable! it is a cheatmodule to show you what you can do.

    the choice of stable or dev is your choice, i would always recommend stables of course.

    “Where exactly can I find the documentation”
    The documentation pages are indeed not yet completed but you can find info here as well. So read all stuff at the project page and this blog.

    I don’t think i can help you any more than this.

  15. miaoulafrite Says:

    hi there, i found out that when enabling reactions, i get the message stuck to the author.

    ie: usermessage

    instead of user : message or user said : message
    where can i configure this?

    thanks

Leave a Reply

 


Warning: is_executable() [function.is-executable]: open_basedir restriction in effect. File(/usr/local/bin/curl) is not within the allowed path(s): (/home/blogmen:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/blogmen/public_html/wp-includes/class-snoopy.php on line 202