0){ $items[] = array( 'path' => $alias, 'type' => MENU_CALLBACK, 'callback' => 'me_relay' ); } } } return $items; } /** * Implementation of hook_settings(). * * Provide a single textbox that allows admins to enter any number of paths containing 'me' */ function me_settings() { $form['me_aliases'] = array( '#type'=>'textarea', '#title'=>t('Aliases to create'), '#default_value'=>variable_get('me_aliases',"user/me"), '#cols'=>50, '#rows'=>6 , '#description'=>t('The per-user aliases to create. Each alias must contain the \'me\' fragment or it will be ignored. Enter one alias per line, and do not include trailing or leading slashes.'), ); return $form; } /** * 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. */ function me_relay() { global $user; if ($user->uid == 0) { drupal_set_message(t('Please login to access your own page.')); $destination = "destination=". drupal_urlencode($_GET['q']); $target = check_url(url('user/login', $destination)); drupal_goto($target); } $index = 0; $dest = ''; $fragment = arg(0); while($fragment) { $dest.=(($dest=='')?'':'/').(($fragment=='me')?$user->uid:$fragment); $index++; $fragment = arg($index); } drupal_goto($dest); }