This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

zovi

  • ***
  • 29 posts
Redirect after login to dashboard
« on: March 08, 2018, 04:50:49 PM »
Hello
Can someone tell me how to set another URL after logging in?

I would like to go here after successful login:
/user/dashboard
May use "osc_user_dashboard_url"

I was looking for "osc_get_http_referer" to change it to "osc_user_dashboard_url", but I couldn't find it anywhere in the plugin.

Thanks in advance.
Zovi

*

MB Themes

Re: Redirect after login to dashboard
« Reply #1 on: March 09, 2018, 11:14:33 AM »
@zovi
I would look for hooks, in theme functions.php you can try to put something like this:
Code: [Select]
function mb_user_logged() {
  header('Location: ' . osc_user_dashboard_url());
  exit;
}

osc_add_hook('after_login', 'mb_user_logged');
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

zovi

  • ***
  • 29 posts
Re: Redirect after login to dashboard
« Reply #2 on: March 10, 2018, 04:28:08 PM »
@zovi
I would look for hooks, in theme functions.php you can try to put something like this:
Code: [Select]
function mb_user_logged() {
  header('Location: ' . osc_user_dashboard_url());
  exit;
}

osc_add_hook('after_login', 'mb_user_logged');

Hi dear
Thanks for reply.

I added the code at the end of the "function. php". Unfortunately it doesn't work.
Still on the main site after login.  :-[

My /oc-content/themes/zara/functions.php
Code: [Select]
}

osc_add_hook('before_html', 'cust_alerts_user_dashboard');

// ad by zovi - dashboard after login =========================================
function mb_user_logged() {
  header('Location: ' . osc_user_dashboard_url());
  exit;
}

osc_add_hook('after_login', 'mb_user_logged');

?>

Marked as best answer by zovi on March 13, 2018, 10:46:02 AM
*

zovi

  • ***
  • 29 posts
Re: Redirect after login to dashboard
« Reply #3 on: March 10, 2018, 04:48:25 PM »
Oh I got it.

I changed the code of google_connect/connect.php
From:
header('Location: ' . filter_var($google_redirect_url, FILTER_SANITIZE_URL));

to:
header('Location:' . osc_user_dashboard_url());


Code: [Select]
      // Flash messages
      if($login_code == 0) {
        osc_add_flash_error_message(__('This account does not exist.', 'google_connect'));
      } else if ($login_code == 1) {
        osc_add_flash_error_message(__('This account has not been activated.', 'google_connect'));
      } else if ($login_code == 2) {
        osc_add_flash_error_message(__('This account has been blocked.', 'google_connect'));
      } else if ($login_code == 3) {
        osc_add_flash_ok_message(__('You have been successfully logged in.', 'google_connect'));
      }
/* change by zovi - Redirect after login to dashboard ====================
      header('Location: ' . filter_var($google_redirect_url, FILTER_SANITIZE_URL));
  */
      header('Location:' . osc_user_dashboard_url());


    }
  }

now I'm on the Dashboard after login. I got the Idea from your answer of https://forums.mb-themes.com/google-connect-plugin/'you-have-been-successfully-logged-in-'-message-does-not-display/msg13783/#msg13783

But the Problem with the Flash messages from topic "You have been successfully logged in. message does not display" is not solved at the moment.

This case/topic "Redirect after login to dashboard" is solved for me. You can close it. Many Thanks

Greez zovi
« Last Edit: March 10, 2018, 04:50:45 PM by zovi »