You are here

function theme_activity_username in Activity 6.2

Same name and namespace in other branches
  1. 5.4 activity.module \theme_activity_username()
  2. 5.3 activity.module \theme_activity_username()
  3. 6 activity.module \theme_activity_username()
  4. 7 activity.module \theme_activity_username()

Theme function to return username. This allows us to theme the username separately for activity feeds then the rest of the site.

3 theme calls to theme_activity_username()
comment_activity_token_values in modules/comment.activity.inc
Implementation of hook_activity_token_values().
node_activity_token_values in modules/node.activity.inc
Implementation of hook_activity_token_values().
user_activity_token_values in modules/user.activity.inc
Implementation fo hook_activity_token_values().

File

./activity.module, line 1051
Primarily Drupal hooks and global API functions to manipulate activity.

Code

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) . '...';
    }
    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;
}