Ewonta Posted August 26, 2019 Share Posted August 26, 2019 (edited) I want to redirect the user to another page with a notification but validator forbids the session_start () function, how then to redirect? public function redirectWithNotifications() { $notifications = json_encode(array( 'error' => $this->errors, 'warning' => $this->warning, 'success' => $this->success, 'info' => $this->info, )); if (session_status() == PHP_SESSION_ACTIVE) { $_SESSION['notifications'] = $notifications; } elseif (session_status() == PHP_SESSION_NONE) { session_start(); $_SESSION['notifications'] = $notifications; } else { setcookie('notifications', $notifications); } return call_user_func_array(array('Tools', 'redirect'), func_get_args()); } Edited August 26, 2019 by timon1 (see edit history) Link to comment Share on other sites More sharing options...
Rolige Posted August 27, 2019 Share Posted August 27, 2019 Hello: Did you tried? Context::getContext()->cookie->notificacion = 'something'; Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted December 14, 2019 Share Posted December 14, 2019 Hi @Rolige @timon1 i need use redirectWithNotifications( ) function in module.php can i use ? Thanks Link to comment Share on other sites More sharing options...
Ewonta Posted December 14, 2019 Author Share Posted December 14, 2019 2 minutes ago, Nishith said: Hi @Rolige @timon1 i need use redirectWithNotifications( ) function in module.php can i use ? Thanks Hi! Yes, there were no comments when checking the module! Link to comment Share on other sites More sharing options...
Ali Samie Posted November 2, 2022 Share Posted November 2, 2022 (edited) This feature does not this exist in AdminController !! Only works in FrontController class Edited September 28, 2023 by Ali Samie (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now