I'm working on an application with multiple roles, admin, faculty and student. Each of them have a unique view of the website according to their roles. An admin's dashboard is different from a faculty member's dashboard, and accordingly, they are redirected to different pages after they log in.
Now, the admin can initiate certain actions, such as accepting applications. When the admin sends an email from his dashboard to students that they can now send the applications, I want that their dashboard be suitably modified ie., the extra option of sending an application is now visible.
So far, I had been dealing with $_SESSION
variable for sending data across pages within the same session. But now I want this information to be stored somewhere, so that when the student logs in, that extra option is visible. What seems to be the best way to do this? My application will have at least 2-3 such situations - accepting submissions, asking faculty members to make preferences etc, all depending upon the admin's decisions on when to initiate this.
You do not need to "pass values from one session to another".
When the admin sends an email from his dashboard to students that they can now send the applications, I want that their dashboard be suitably modified
You simply need to change some state in your application, i.e. the database.
After the dashboard has read that state, it comes down to a simple test:
if (!$user_already_applied) {
if ($applications_open) {
// display application form
}
else {
}
}
else {
// whatever you want to happen...
}
$_SESSION is a superglobal varible, and every user can access only one instance of a session, You have to create a role based system, for every role you can mention what type of functionality is accessible for each user when that user uses his own account then only that functionality/pages will be available to them