/**
  * Logs in the user with given user id
  *
  * @param $user_id
  */
 public function login_wp_user($user_id)
 {
     wp_set_auth_cookie($user_id, 0, '');
     do_action('wpof_oauth_login', $user_id, $this->submenu_slug);
     header('Location:' . Admin_Menu::get_success_login_url());
 }
 private static function redirect_to_login_url_with_error($error_code, $service)
 {
     $args = array('wpof_error' => $error_code, 'service' => $service);
     $url = add_query_arg($args, Admin_Menu::get_error_login_url());
     header('Location: ' . $url);
     die;
 }