What would it take ($?) to expose tokens for this module so that, for example, the actions or rules module could send a tokenized email to the author of the node target ie. Your page received a comment. I tried it myself, but I'm sure I'm missing something. Maybe it'd be easier for someone who knows how this module works. Basically I tried this in various incarnations:


/**
* Implementation of hook_token_values.
*/
function node_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node') {
    $node = $object;
    $tempuid = db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", $node->comment_target_nid)); 
    $target_email = db_result(db_query("SELECT mail FROM {users} WHERE uid = %d", $tempuid));
    $values['target-email']  = $target_email;
    return $values;
  }
}

/**
* Implementation of hook_token_list.
* Seems to work fine.
*/
function node_token_list($type = 'all') {
  if ($type == 'node' || $type == 'all') {
    $tokens['node']['target-email']    = t("Comment target-node user's email.");
    return $tokens;
  }
}

Comments

crea’s picture

Status: Active » Closed (fixed)

1.2 branch is not supported anymore. Closing.