This topic is locked
[SOLVED]

Redirect after successful login to a particular dashboard

11/5/2022 10:42:33 AM
PHPRunner General questions
lefty author

I am trying to find the best way to redirect user based on his security group ( dynamic permissions ) to a certain dashboard.

Is the best way to use sessions and add a group_id for each user in my users table or will the Security API take care of this?

I am trying to have a dashboard for each security group , example Admin, Sales, Management, etc.....

Admin 11/5/2022

The easiest option for you is to use AfterSuccessfulLogin event and redirect user to one of dashboards based on their group name.

Sample code:

if (Security::getUserGroup()=="admin") {
header("Location: dashboard1_dashboard.php");
exit();
}