You are here

function useractivity_token_values in Activity 6

Same name and namespace in other branches
  1. 5.4 contrib/useractivity/useractivity.module \useractivity_token_values()

Token module integration. Defines available default token values.

File

contrib/useractivity/useractivity.module, line 77

Code

function useractivity_token_values($type, $data = NULL, $options = array()) {
  global $user;
  static $authors;
  if ($type == 'useractivity' && !empty($data)) {
    if (!isset($authors[$data['target-uid']])) {
      $authors[$data['target-uid']] = activity_user_load($data['target-uid']);
    }
    $target = $authors[$data['target-uid']];
    $data['possessive'] = $user->uid == $data['uid'] ? t('your') : t('their');
    $target_profile = theme('activity_username', $target, TRUE);
    $data['target-profile'] = $target_profile == t('you') ? t('your') : $target_profile . t('\'s');
    $data['target-profile-name'] = $target->name;
    return $data;
  }
}