You are here

function me_relay in me aliases 5

Forward to same url with proper uid this time.

The paths have already been checked to contain 'me' in the _menu hook. We don't have to check node access, drupal_goto will take care of that.

1 string reference to 'me_relay'
_me_create_menu_items in ./me.module
Helper function to create our menu items.

File

./me.module, line 86

Code

function me_relay() {
  global $user;
  if ($user->uid != 0) {
    $index = 0;
    $destination = '';
    $fragment = arg(0);
    while ($fragment) {
      $destination .= ($destination == '' ? '' : '/') . ($fragment == 'me' ? $user->uid : $fragment);
      $index++;
      $fragment = arg($index);
    }
    drupal_goto($destination);
  }
  else {

    // user is not logged in
    drupal_set_message(t('Please login to access this personalised page.'));
    $destination = "destination=" . drupal_urlencode($_GET['q']);
    drupal_goto('user/login', $destination);
  }
}