me_redirect) && empty($view->live_preview)) { // We should always be able to redirect here regardless, as our handler has to // have run for our option to be set, which means we need to redirect anyway. // Loop over the argument handlers to get the arguments we need. We also keep this // consistent with any extra arguments that may have been passed in. $arguments = $view->args; foreach (array_values($view->argument) as $key => $argument) { if (isset($argument->argument)) { $arguments[$key] = $argument->argument; } } // Redirect to the path. drupal_goto($view->get_url($arguments)); } } /** * Helper function to set the views user arguments we override. * * @param $arg * The arg(s) we are checking. * @param &$view * The view object. * @param $break_phase * Helps us determine if there are multiple arguments. * @param $username * Wehter or not this is the username argument. * * @return string * The modified argument list. */ function _me_views_set_argument($arg, &$view, $break_phase, $username = FALSE) { $uid_args = array(); $seperator = ' '; if (empty($break_phase)) { $uid_args[] = $arg; } else { // Modified from views_break_phrase() to include characters that a 'me' alias // may include. if (preg_match('/^([0-9a-zA-Z]+[+ ])+[0-9a-zA-Z]+$/', $arg)) { // The '+' character in a query string may be parsed as ' '. $uid_args = preg_split('/[+ ]/', $arg); } else if (preg_match('/^([0-9a-zA-Z]+,)*[0-9a-zA-Z]+$/', $arg)) { $seperator = ','; $uid_args = explode(',', $arg); } } // Check if we need to do a redirect, and make sure the option is disabled if we don't. if ($view->me_redirect) { $redirect_args = array_filter($uid_args, create_function('$n', 'return _me_is_alias($n);')); if (empty($redirect_args)) { $view->me_redirect = FALSE; } } // The alias could potentially show up more than once. Loop over each argument // and check to be sure. foreach ($uid_args as $key => $uid_arg) { $uid_args[$key] = _me_check_arg($uid_arg, $username, FALSE); } return implode($seperator, $uid_args); }