function user_token_info

Same name in other branches
  1. 9 core/modules/user/user.tokens.inc \user_token_info()
  2. 8.9.x core/modules/user/user.tokens.inc \user_token_info()
  3. 10 core/modules/user/user.tokens.inc \user_token_info()
  4. 11.x core/modules/user/user.tokens.inc \user_token_info()

Implements hook_token_info().

File

modules/user/user.tokens.inc, line 11

Code

function user_token_info() {
    $types['user'] = array(
        'name' => t('Users'),
        'description' => t('Tokens related to individual user accounts.'),
        'needs-data' => 'user',
    );
    $types['current-user'] = array(
        'name' => t('Current user'),
        'description' => t('Tokens related to the currently logged in user.'),
        'type' => 'user',
    );
    $user['uid'] = array(
        'name' => t('User ID'),
        'description' => t("The unique ID of the user account."),
    );
    $user['name'] = array(
        'name' => t("Name"),
        'description' => t("The login name of the user account."),
    );
    $user['mail'] = array(
        'name' => t("Email"),
        'description' => t("The email address of the user account."),
    );
    $user['url'] = array(
        'name' => t("URL"),
        'description' => t("The URL of the account profile page."),
    );
    $user['edit-url'] = array(
        'name' => t("Edit URL"),
        'description' => t("The URL of the account edit page."),
    );
    $user['last-login'] = array(
        'name' => t("Last login"),
        'description' => t("The date the user last logged in to the site."),
        'type' => 'date',
    );
    $user['created'] = array(
        'name' => t("Created"),
        'description' => t("The date the user account was created."),
        'type' => 'date',
    );
    $user['changed'] = array(
        'name' => t("Changed"),
        'description' => t("The date the user account was changed."),
        'type' => 'date',
    );
    return array(
        'types' => $types,
        'tokens' => array(
            'user' => $user,
        ),
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.