You are here

function _me_get_me_alias in me aliases 8

Same name and namespace in other branches
  1. 6.2 me.module \_me_get_me_alias()
  2. 6 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.

6 calls to _me_get_me_alias()
me_plugin_argument_validate_me_alias::options_form in includes/views/handlers/me_plugin_argument_validate_me_alias.inc
me_to_arg in ./me.module
Menu to_arg function for %me.
me_uid.inc in plugins/arguments/me_uid.inc
Plugin to provide an argument handler for user uid *and* "me"
me_user_categories in ./me.module
Implements hook_user_categories().
me_user_view in ./me.module
Implements hook_user_view().

... See full list

File

./me.module, line 478
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);

  // 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;
}