Hi fellow cooks!
I know how to set a custom session variable using
$myComponentSession = $session->set('my_component_session');
& retrieve it using
$myComponentSession = $session->get('my_component_session');
however, the part I'm missing is HOW DO I AUTOMATICALLY SET THIS WHEN THE USERS LOGIN?
Scenario
Basically, I need to run a db query to check if the newly logged in user is a project user, look up their
user_id in my
project_users table then iterate through a
project_tasks,
project_events and so on, building an
associative session array. I need this so that I can check if a user has
incomplete tasks and redirect them accordingly and to let them know of upcoming tasks, + to get feedback on events that they've attended... This part is easy! I'm going to do this in a function, let's say
createProjectUserSession() where all of the necessary queries are run.
My problem is knowing exactly
how to invoke this createProjectUserSession as soon as the user log's in. I know in my component I can call it in the main controller by always redirecting them to my component after login however, I don't want admins of the component to have to set it up that way. The idea is that if a user has
incomplete tasks/overdue tasks, they will not be able to go anywhere else on the site until it's done - a flag in the session!
Can I and if so, somehow bind this function to an onAfterLogin even???
Any help with this would be most appreciated!!!
Many thanks,
Gez