Closed (fixed)
Project:
Activity
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
17 Sep 2009 at 21:35 UTC
Updated:
24 Jan 2010 at 16:02 UTC
This arose out of this ticket #473946: Provide clean url tokens to node author profile.
Essentially, because the administrator has explicitly chosen to create a link to the user's profile, regardless of permissions we need to do it. This is especially true, because we record the message once and never regenerate it.
Something like
/**
* default theme implemenation for activity_username
*/
function theme_activity_username() {
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) .'...';
}
else {
$name = $object->name;
}
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
return $output;
}
Comments
Comment #1
Scott Reynolds commentedSirkitree already thought of this problem. I just updated the function to do what I described above and updated the link tokens to use that.
Comment #2
sirkitree commentedYup, we also have this in the 1.x version for this very reason.
Comment #4
sadist commentedsorry, i reported here: http://drupal.org/node/473946 that this wasn't working but it actually did. but it printed as Anonymous instead of the author's name.
Comment #5
sirkitree commentedsadist, that function needs the $object passed in: