Hi,

Has someone perhaps figured out how to include the realname as a token in example:

[activity-user-link][realname] flagged [title]

activity-user-link puts out the username and not the full name supplied by 'realname.module'.

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

CommentFileSizeAuthor
#7 token form.jpg90.32 KBryan88
#7 tokens.jpg54.65 KBryan88
#6 screenshot.gif30.29 KBliliplanet

Comments

liliplanet’s picture

* bump * sorry :)

activity-user-link puts out the username and not the full name supplied by 'realname.module'

would most appreciate this capability please ..

sirkitree’s picture

This would only really require a new token from RealName module that could be used in Activity2.

ryan88’s picture

Status: Active » Closed (fixed)

If you are still looking for the answer to this, I use the token [realname-link] to output a link to their profile. The only time this doesn't work is when a new user joins the website; when the activity message gets created, the realname has not been created yet, so it just outputs anonymous user.

liliplanet’s picture

Thank you Ryan, but unfortunately in the case where you want to record an activity of a flag on a node, eg

[activity-user-link] or [realname-link] flagged [title]

Result:

[activity-user-link] is the username of the person that did the flag activity
[realname-link] is the author of the node that the person did the activity on

realname-link outputs the author of the node, and not the person that flagged the item.

Therefor we have to use [activity-user-link], but that only outputs username and not realname

Most forward looking to a solution for this, as currently no activities make sense as users do not know the usernames, only the realname.

ryan88’s picture

Ah yes, I had the same problem. To solve this, I used the Token Custom module to create my own tokens. I created a new user token that used the following code:

$name = "<a href='/".drupal_get_path_alias('user/'.$user->uid)."'>".realname_make_name($user)."</a>";
return $name;

This records the name of the person who is logged in when the activity occurs. It should work for what you need it to, it works well for me.

Hope this helps.

liliplanet’s picture

Status: Closed (fixed) » Active
StatusFileSize
new30.29 KB

Wow Ryan, if I could figure that out would be fabulous :)

I've installed custom token, then added token as attached screenshot, but then I get a blank page, so that can't be good.

If you would be so kind to show me a screenshot or how to set this up, would be most appreciated ..

Look forward to hearing from you.
Lilian

ryan88’s picture

StatusFileSize
new54.65 KB
new90.32 KB

I believe you are doing it correctly. I attached the form where I used the same info as you did, and when I hit save, it takes me back to the main token page where it lists all of my tokens. You can see that it displays a sample under "Demo (if available)." If you go back to the custom tokens, does it not show the token you tried to create? If it is not saving, you may need to consult the issues for custom token. The only time I ever have a blank page after saving something is when I have the Form module enabled. Once you can get the tokens to save, it should work just fine for you. Obviously, once it works, you would just put [token_custom_33] and it would print the users name.

I'm not sure what else to suggest. A blank page is not normal, it should take you back to the Custom Tokens page. Maybe the author of the Custom Tokens module can help further.

liliplanet’s picture

The following works .. Replace this code in activity.module

/**
 * Theme function to return username.
 * This allows us to theme the username separately for activity feeds then the
 * rest of the site.
 */
function theme_activity_username($object) {
  if ($object->uid && $object->name) {
    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($object->name) > 20) {
      $name = drupal_substr($object->name, 0, 15) .'...';
      $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
    }
    else {
      $output = theme('username', $object);
    }
  }
  else {
    $output = check_plain(variable_get('anonymous', t('Anonymous')));
  }

  return $output;
}

Thank you Guy!

liliplanet’s picture

Thank you Ryan for your kind help. I've now gone with replacing code directly in the activity.module and will see how that goes, otherwise will revert to the token ... Most appreciated :)

rjbrown99’s picture

Liliplanet - Can you confirm this issue has been resolved? If so can we change the status to fixed? Thank you.

liliplanet’s picture

Thank you rjbrown99, I've actually moved on to Drupal7 and have not installed Activity as yet. Most appreciate your support!

rjbrown99’s picture

Status: Active » Fixed

OK, if you need more help with this particular issue feel free to reopen. In the meantime I'll close this out. I'm trying to clean up the issue queue a bit.

Status: Fixed » Closed (fixed)

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