Hello,

I use Rules to send our notification messages when a relationship request is sent.
I noticed the Elaboration is not available as a token and would like to kindly request if it could be added?

Thank you!

Comments

Bilmar’s picture

Status: Active » Needs review

Hi everyone,

Yea, this would be really cool!

I have only able to find the below tokens available in the relationship object in rules.

Replacement patterns for The relationship object
User_relationships_api tokens
[relationship:requestee]	The user who approved the connnection request.
[relationship:relationship-name]	The relationship name (singular form)

I don't know programming at all, but browsed all the files and found that the tokens were added in this file: user_relationships_api.module

I kinda just copied what I saw and added it as 'elaboration' =)
To my surprise, I tested it and it worked!
But I'm afraid I really don't know what I'm doing so it would be really nice if someone can check out the below and give me a thumbs up or down? If it looks good, I'll submit a proper patch so it is easy for the maintainer to commit.

So, in user_relationships_api.module I added 'elaboration' => t('The elaboration sent with the relationship request.'), and 'elaboration' => $r->elaboration,

I also noticed that The user who approved the connnection request. misspells 'connection'.

  elseif ($type == 'relationship') {
    $tokens['user_relationships_api'] = array(     
      'requestee' => t('The user who approved the connnection request.'),
      'relationship-name' => t('The relationship name (singular form)'),
      'elaboration' => t('The elaboration sent with the relationship request.'),
    );
  }
    $token_values = array(
      'requestee' => theme('username', user_load(array('uid' => $r->requestee_id))),
      'requester' => theme('username', user_load(array('uid' => $r->requester_id))),
      'relationship-name' => theme('placeholder', $r_type->name),
      'elaboration' => $r->elaboration,
    );

Setting to 'needs review' just so people know there is something here.
But again, I will submit a proper patch if someone can please input words of wisdom =)

mrf’s picture

Component: Code » Elaborations
Category: support » feature
Status: Needs review » Active
mrf’s picture

Status: Active » Postponed

I am postponing any 6.x feature requests that don't have a current applicable patch to help sort the large list of open features.

Please feel free to set to 'needs review' once a patch is included.