Hello and first of all thanks for a great module!

I am wondering if the activity messages could be limited to certain (cck) fields:

I have a content type ("Personal info"), where users can input data in certain cck fields, such as Name, favourite football club, favourite food, favourite movie etc. I have then created a new activity template for each of the fields (thanks to token support). Once a user changes one of the field's content, the message would display e.g.: User "xyz" has changed his favourite movie to "abc".

However, once a user changes one of the fields, all of the other fields will also be included in the activity message as updated - even if there was no change at all.

So to my understanding, you can only apply the "update check" to a complete node and not only to a certain field. In the above scenario this means that I could only create a message like "User "xyz" has updated his Personal info but cannot target a certain part of that node only. I hope I understood this right - please correct me if I am wrong.

If so - wouldn't it be a great enhancement to be able to limit the messages to certain fields of a node?

P.S. sorry if this issue seems to make no sense - still rather new to Drupal :)

Comments

Scott Reynolds’s picture

Status: Active » Closed (works as designed)

This is a rather advanced functionality that will not be part of the module. HOWEVER, it is doable with some code. Here is an incomplete snippet fro setting up the action which is by far the hardest part.

function my_module_nodeapi() {
  static $personal_info = FALSE;
  if ($op == 'prepare') {
    $personal_info = $node->field_personal_info[0]['value'];
  }
  if ($op == 'update') {
    if ($node->field_personal_info[0]['value'] != $personal_info) {
       $aids = _trigger_get_hook_aids('personal_info', $op);
       $context = array('hook' => 'personal_info', 'op' => $op, 'node' => $node);
       actions_do($aids, $node, $context, $a3, $a4); // $a3 and $a4 are part of hook_nodeapi().
    }
  }
}

From there then you now have a hook ready for trigger implementation. Once you write the trigger implementation, then you have to write the activity wrapper of the trigger.

See this for the trigger implementation: http://drupal.org/node/172152

And then read up on the DEVELOPERS.txt in the activity folder.

Golem07’s picture

Ahhh... a pity. Well thanks for the clarification still.
And thx for the instructions on how this could be accomplished, even though my knowledge about coding is by far too limited to accomplish such a task. Still a wonderful module though!