Hi,

I'm a little confused as to how to add [requestor] is now friends with [requestee]

First of all it puts out the username and not realname (and no links).

When I add [realname-link] is now friends with [realname-link] it just puts out the same name.

[requestor-url] outputs the userid/* (also not as a link)

Might be blonde here, but definitely missing something :)

Look forward to any reply, and thank you.
Lilian

Comments

sirkitree’s picture

We gave the ability to put html in those fields. We're thinking of making it more obvious and actually putting them through input formats as well. But you should be able to do something like

<a href="[requestor-url]">[requestor]</a> is now friends with <a href="[requestee-url]">[requestee]</a>.
liliplanet’s picture

Thank you Sirkitree, that looks good, but the problem is that [requestor] and [requestee] outputs 'username' and not 'realname'. Basically users will not know who they are ...

Do you perhaps have a suggestion to make that possible?

Thank you so much.

Lilian

sirkitree’s picture

suggest that you create some new tokens for this, submit a patch and i'll throw it in :)

liliplanet’s picture

Hi,

Has anyone perhaps been able to have [requestor] or [requestee] as 'realname' and not 'username' perhaps?

Look forward to any reply, and thank you :)
Lilian

BenK’s picture

Tracking...

liliplanet’s picture

Wondering if anyone has perhaps been able to output realname and not 'username' as [requestor] or [requestee]?

Right now users actually do not know who the activity person is ..

Look most forward to any solution, and thank you ...
Lilian

Scott Reynolds’s picture

Its been something I have been thinking about a lot recently. Essentially, abstracting the user tokens in a manner that behaves the same as D7 tokens but is implemented completely differently. Boils down to this

flag_friend_token_list() {
  foreach (token_get_token_list('user') as $token) {
     $tokens[] = 'requestee-' . $token;
     $tokens[] = 'requestor-' . $token;
  }
}

Basically, it means that you just prefix all user tokens and you can use the ALL existing tokens. It would be quite magical and FAR easier to maintain.

liliplanet’s picture

Wow Scott, that sounds fabulous .. a question though, the code in #7, is it ready for use and if so, do I add it to template.php or drop it in flag_friend?

In activity 'requestee_realname' is now friends with 'requestor_realname' would be an amazing enhancement :)

Look most forward to your reply.
Lilian

liliplanet’s picture

The following works .. replace this code in your flag_friend module:

/**
 * Implementation of hook_token_values().
 */
function flag_friend_token_values($type, $object = NULL, $options = array()) {
  if (($type == 'flag_friend') && !empty($object)) {
    $data = array();
    $data['requestor'] = theme('username', $object->friend);
    $data['requestee'] = theme('username', $object);
    $data['requestor-uid'] = $object->friend->uid;
    $data['requestee-uid'] = $object->uid;
    $data['requestor-url'] = base_path().drupal_get_path_alias('user/'.$object->friend->uid);
    $data['requestee-url'] = base_path().drupal_get_path_alias('user/'.$object->uid);
    return $data;
  }
}

Thank you Guy!

sirkitree’s picture

Title: Flag Friend Activity » Flag Friend Activity Tokens
Project: Activity » Flag Friend
Version: 6.x-2.x-dev » 6.x-1.x-dev
Component: Activity Contrib » Code
Category: support » feature
Status: Active » Needs review

Moving to the Flag Friend issue queue.

sirkitree’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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