You are here

function _me_get_me_alias in me aliases 6

Same name and namespace in other branches
  1. 8 me.module \_me_get_me_alias()
  2. 6.2 me.module \_me_get_me_alias()
  3. 7 me.module \_me_get_me_alias()

Helper function to return the me alias.

Parameters

$print_name: Shows a friendly print name of the alias instead of the actual alias itself. This argument is only checked if the token module is installed.

Return value

string The me alias, token replaced if appropriate.

3 calls to _me_get_me_alias()
me_to_arg in ./me.module
Menu to_arg function for %me.
me_user in ./me.module
Implementation of hook_user().
_me_is_alias in ./me.module
A helper function to check if a string is equal to the 'me' alias.

File

./me.module, line 462
Provides 'me' aliases to allow users to enter 'me' in common paths instead of their user id.

Code

function _me_get_me_alias($print = FALSE) {
  $alias = me_variable_get('me_alias');

  // Replace with any global tokens that might have been used in the alias.
  if (module_exists('token')) {
    $replaced_alias = token_replace($alias, 'global');

    // They will not match if a replacement happened.
    if ($print && $replaced_alias != $alias) {
      $alias = ucwords(str_replace(array(
        '-',
        '[',
        ']',
      ), array(
        ' ',
        '',
      ), $alias));
    }
    else {
      $alias = $replaced_alias;
    }
  }
  return $alias;
}