You are here

function login_destination_user in Login Destination 6

Same name and namespace in other branches
  1. 6.2 login_destination.module \login_destination_user()

Implementation of hook_user.

File

./login_destination.module, line 105

Code

function login_destination_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'login':
      global $language;
      $destination = variable_get('ld_url_destination', 'user');
      if (variable_get('ld_url_type', LOGIN_DEST_STATIC) == LOGIN_DEST_SNIPPET) {
        ob_start();
        $url = eval($destination);
        ob_end_clean();
      }
      else {
        $url = $destination;
      }
      if (is_array($url) && !empty($url['path'])) {
        $path = $url['path'];
        unset($url['path']);
        $base = base_path();
        if (!empty($language->prefix)) {
          $base .= $language->prefix . '/';
        }
        $url = str_replace($base, '', url($path, $url));
      }
  }
  if (login_destination_apply_redirect()) {
    $_REQUEST['destination'] = $url;
  }
}