Is there a way that I can show activities, including facebook style status updates to users who are related to each other using user relationship module. I thought the blocks that come pre-configured with this module allowed that functionality. However I am not able to see this kind of relational activity

Basically this is the workflow I am trying to achieve
1) User A to Follow User B - Done as a 1 way relationship
2) As soon User B updates his facebook style status, it gets reflected for User A as the user is Following User B
3) When User B performs some other action like add comment etc , it gets reflected to User A as the User is following User B
4) If User C (Which User A is not following) performs some actions then they should not be reflected to User A

I installed Heartbeat, User relationship as well as Facebook style statuses module on a simple drupal installation and I have enabled all blocks, views etc associated with these modules but am not able to see this kind activity

Can someone guide me in the right direction please

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stalski’s picture

I have this installed as well, and it works fine for me. Difficult to say from here what you did wrong.
My first guess is that your activity message is a user logging and nog a normal one. It should be a normal one as user actions are for both way relationships.

But i can also recommend defining your own stream class so you have the whole query in hand. Examples can be found in most submodules.
The query defines what will be fetched and then the stream configuration will filter out messages where the viewer has no access to.

If you log your stream configuration and message template here and your rule setup (or code if you use that) , maybe i can tell more.

Stalski’s picture

Status: Active » Postponed (maintainer needs more info)
manuj_78’s picture

Hi Stalski,
Can you elaborate a bit more on "My first guess is that your activity message is a user logging and nog a normal one." . According to my assumption , this is dictated by the rule that comes pre-configured I think with this module right. So do you mean I need to update the rule?

manuj_78’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
22.65 KB
5.87 KB

Please find attached the templates export as well as rules export of heartbeat and fecbook style status category

Stalski’s picture

hmm , so i understand that you use only the predefined rules with the correct heartbeat log actions ...
I really don't have a clue then. I am willing to take a look at the site itself if you have a online or acceptance url for it?

Stalski’s picture

For the record:

- The block you need is "connectedheartbeat" , with the description of "relational heartbeat activity".
- both comments updates and fb status updates should get logged in the database table heartbeat_activity (you could enable the rules development messages so you see if it gets triggered and logged)
- The block or the page /heartbeat/connectedheartbeat should show you the correct stream for the logged-in user, being the activity performed by you or the people you are connected too (in your case following)
- The fact that you see the messages of you and the persons you are following is calculated by heartbeat_get_related_uids that calls module_invoke_all so friendsactivity module knows the relations. You could debug there as well to see if the query for your friends-api works correct.

A few questions:

- Which user relations api do you use? (friendlist, flag_friend and User Relationships are supported)
- Did you select the correct one on the settings page?
- What do you mean with "but am not able to see this kind activity" ? Which page are you on, does the page work, is it saying "no activity yet" ...

regards,

Stalski

manuj_78’s picture

I was testing the module on my local machine as I follow a 2 step testing process before installing anything on the main site..I first test it locally, then I move it to a staging site which is a copy of my main site..once I am satisfied that it is working fine, then I move it to the main site. If it doesnt work on my local machine, what I can do is install all of this on my staging site as well and give you the details so you can have a look.

1) With regards to the blocks..I enabled all the modules that came with the heartbeat and user relationship module in hope of seeing activity related to facebook status messages
2) I am able to see activity related to comments but I am not able to see activity related to facebook status messages in the relational block
3) /heartbeat/connectedheartbeat did not show the activity related to the person I was following

a) I am using User Relationships
b) There was only one relationship in the settings page for User Relationships which I have selected
c) When I say "but am not able to see this kind activity" I mean that I can see relational activity when a contact I follow creates a comment but I am not able to see the activity when this contact adds a facebook status message

Let me go through the settings of Heartbeat, User Relationships, Facebook Style Status as well as Rules once again today. I will also enable the debug you have mentioned to see if I see any kind of logs.

Will report back with the results

Manuj

manuj_78’s picture

I enabled the rules debug and got the following messages as soon as I submitted a facebook style message

0 ms "User adds or updates a status" has been invoked.
0.132 ms Executing the rule "Submit Facebook-style Status" on rule set "User adds or updates a status"
0.301 ms Warning: Unable to get variable "account".
0.324 ms PHP is not evaluated as there are not all necessary variables available.
0.382 ms Element "Log to watchdog" has not been executed. There are not all execution arguments needed by an input evaluator available.
0.456 ms Evaluation of "User adds or updates a status" has been finished. 
Stalski’s picture

Ok then actually everything is working very good. the only thing i can think of, is the fact that the uid_target is not properly set.
So in general what you need to have as result : UserA is following UserB and
- UserB comments on a node
* uid = uid of UserB, logged as the uid of the currently logged-in user
* nid = nid of the node the comment is on, logged as the commented node nid
* (uid_target = uid of the author of the commented node, logged as the node uid)

- UserB updates his fb status
* uid = uid of UserB, logged as the uid of the currently logged-in user
* (uid_target = uid of the target user, logged as the addressee uid)

When fetching, relational activity will fetch all messages, where uid IN ("all the users relationships")
So in your case your fb_status messages should appear as any other message, just because the uid is in the relational uids.

So the only thing you should know now, is who are the related users for userA (needs that userB). Appearently it works since you see the commented messages.
The facebook status messages, somehow, get blocked. I always go to checkAccess method in heartbeatMessageBuilder (or is it the parser) and see what is blocking it.

Stalski’s picture

ok i think if found the problem. I looked too quickly to your comment in #8. You don't log messages for facebook status to heartbeat. There is no default rule in heartbeat that does it. There is a default rule that is executed, see your comment in #8, but that one is provided by the module facebook_statusses.

Thus you could easily use this rule that fbstatus provides and
- delete the watchdog action, which does not seem to work (maybe you should check this in fb_status).
- add an action in that rule that defines the heartbeat action for single users, with the specs defined above.

So this is not really a bug then. keep me up to date so i can close this one :)

I hope i could help you with this.

regards,

Stalski

Stalski’s picture

I tried it out just now, and underneath are the exports that did the job. (so this is nog in heartbeat by default and this is by design)

First the heartbeat message template (which you could import or add it in a custom hook_heartbeat_messages_info):

array (
  0 => 
  array (
    'message' => '!message',
    'message_concat' => '',
    'message_id' => 'heartbeat_facebook_status_update',
    'concat_args' => 
    array (
      'type' => 'single',
      'group_by' => 'none',
      'group_target' => '',
      'group_by_target' => '',
      'group_num_max' => '',
      'merge_separator' => '',
      'merge_end_separator' => '',
      'roles' => 
      array (
        0 => '0',
        1 => '0',
      ),
    ),
    'description' => 'The message of a user updating his status.',
    'perms' => '2',
    'custom' => 1,
    'variables' => 
    array (
    ),
  ),
);

Then the rule itself (altered from the built-in fbstatus one)


array (
  'rules' => 
  array (
    'facebook_status_rules_update' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_facebook_status_update',
      '#label' => 'Submit Facebook-style Status',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
        0 => 'facebook_status',
      ),
      '#status' => 'altered',
      '#conditions' => 
      array (
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Logs default activity for the status update',
            'label callback' => false,
            'eval input' => 
            array (
              0 => 'uid_param',
              1 => 'uid_target_param',
              2 => 'nid_param',
              3 => 'nid_target_param',
              4 => 'message_id_param',
              5 => 'variables_param',
            ),
            'module' => 'heartbeat',
          ),
          '#name' => 'heartbeat_rules_default_action',
          '#settings' => 
          array (
            'uid_param' => '[poster:uid]',
            'uid_target_param' => '[owner:uid]',
            'nid_param' => '0',
            'nid_target_param' => '0',
            'message_id_param' => 'heartbeat_facebook_status_update',
            'variables_param' => '@message=|=[status:status-unformatted]-|-',
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'uid_param' => 
                array (
                  0 => 'poster',
                ),
                'uid_target_param' => 
                array (
                  0 => 'owner',
                ),
                'variables_param' => 
                array (
                  0 => 'status',
                ),
              ),
            ),
          ),
          '#type' => 'action',
        ),
      ),
      '#version' => 6003,
    ),
  ),
);

This works fine for me. Tested it on a clean install with only heartbeat, ur and fbstatus (and needed submodules ofcourse)

manuj_78’s picture

That seems to have done the trick - I can see facebook status now showing properly. maybe including this as a default template in heartbeat module will be a good idea

I have,however, run into another issue :-(

If I or a related user adds a comment I can see their activity showing in the "Heartbeat relational activity" stream but

when a user creates a new node, its activity is not showing anywhere..It does not show in personal heartbeat activity or if there is a relationship, then it does not show in "Heartbeat relational activity" also

P.S. I have not made any change except the one above you suggested..I am just trying to use the default templates and rules that came with the modules

Stalski’s picture

Status: Active » Fixed

That seems to have done the trick - I can see facebook status now showing properly. maybe including this as a default template in heartbeat module will be a good idea

Heartbeat can only add some integration, but for only this couple of lines, i would not do this. Rules UI is ment for things like that.

when a user creates a new node, its activity is not showing anywhere

For the other problem. Again check what the rules debug says. There is nothing default in heartbeat except a page (node type). all other nodes you could do yourself. If their all the same , you just drop that node type condition in rules. In your case, i think again nothing is logged to the database since you see it nowhere.

Every community has such specific requirements that heartbeat can not forsee all possible use-cases. The rules integration approach is there because i feel it rocks in it's usability and being able to delegate all the commands we need. I only pick in into this process. The site builders need to configure, add, alter message templates and rules specific to their needs.

If the problem consists after reconfiguring the rules and activity templates to your needs, feel free to open a new ticket with for that specific problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

udvranto’s picture

Version: 6.x-4.9 » 6.x-4.x-dev

This is not working for me. I get an error whenever I go to admin/rules/trigger:

event_facebook_status_update can't be found. Probably the providing module has been deactivated.

karthid’s picture

event_facebook_status_update can't be found. Probably the providing module has been deactivated.

marinex’s picture

If you are using FBSS 3.x the "event_facebook_status_update" is replace by "event_facebook_status_save" rule.