Michael Posted March 16, 2017 Report Posted March 16, 2017 Hi guys, Is there a way to grab the current logged in staff ID in the admin area / client id? I've tried: $client->first_name thinking as they use the same table that would work. $staff->first_name & $admin->first_name trying to see if that works as the above didn't. Tried grabbing them like: $staff->staff_id & $admin->staff_id & $staff_first_name & $staff_id & $session->staff_id but none seem to work Merci.
Michael Posted March 19, 2017 Author Report Posted March 19, 2017 @Mujahed has helped me get this working this guy is a legend :p. In each controller in /app/controllers/admin_*.php add the following code: $this->structure->set("blesta_staff_id", $this->Session->read("blesta_staff_id")); in this function: public function preAction() { } Eg admin_billing.php: public function preAction() { parent::preAction(); // Require login $this->requireLogin(); Language::loadLang(['admin_billing']); $this->structure->set("blesta_staff_id", $this->Session->read("blesta_staff_id")); [...] } This allows you to use this command to get the staff_id: <?php $blesta_staff_id; ?>
Blesta Addons Posted March 20, 2017 Report Posted March 20, 2017 if you want only the staff id , you can get it in the PDT files without changing other files . simply make it like that in your admin template file . <?php echo $this->Html->ifSet(Session::read("blesta_staff_id")); ?> and let me ask Blesta team about the admin_controller.php . is not called anywhere, no ? client_controller.php is called in all client_*.php file , that give us the option to add what we want in that file and is accessible in all client view . why not also change all admin_*.php file to extend the AdminController instead of AppController ? (just to note this is note a request , is just a question to know something more about blesta ) Michael 1
Michael Posted March 20, 2017 Author Report Posted March 20, 2017 22 minutes ago, Blesta Addons said: if you want only the staff id , you can get it in the PDT files without changing other files . simply make it like that in your admin template file . <?php echo $this->Html->ifSet(Session::read("blesta_staff_id")); ?> and let me ask Blesta team about the admin_controller.php . is not called anywhere, no ? client_controller.php is called in all client_*.php file , that give us the option to add what we want in that file and is accessible in all client view . why not also change all admin_*.php file to extend the AdminController instead of AppController ? (just to note this is note a request , is just a question to know something more about blesta ) Think I tried something that I think as the sessions aren't set in the view just the controllers, so we needed to set a variable and there's one controller we could have used: app_controller.php is encoded which is for licensing I believe :). I use it so I can autoplay my favourite radio station but Callum and Matthew don't get it as they aren't a fan of it lol.
Blesta Addons Posted March 20, 2017 Report Posted March 20, 2017 From the view you can access any Blesta class is loaded by default like Session . if the admin_*.php files was extending the admin_controller.php , you can set this in only 1 file .
Tyson Posted March 20, 2017 Report Posted March 20, 2017 They will probably extend AdminController in the future. Michael 1
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now