I have some code inside a method hooked to entry_submission_redirect which calls $this->EE->session->set_flashdata(), and passes in an array like so:
$messages = array();
$messages["message_success"] = "Success message goes here";
$this->EE->session->set_flashdata($messages);later on in the entry_submission_redirect, I am either redirecting the user back to the Publish Form (if there is an error), or not redirecting them at all and passing back the $orig_loc parameter, which takes them to the “View Entry” page (default behavior).
My issue is, when I let the default behavior happen, and I get redirected to the View Entry page, my Flash Messages do not show up. When I redirect them to the Publish page they do, correctly. I have also been having problems setting cookies from this method, using $this->EE->functions->set_cookie(), which doesn’t add the cookie.
Has anyone run into this issue before? It seems like sessions and cookies are unable to be set from this method…?
Thanks in advance!
Hi Bryant,
What version of ExpressionEngine are you developing against?
If you think you’ve found a bug, be sure to file it in the Bug Tracker.
For now though, I have to move this over to Development and Programming.
Thanks!
I don’t think this is a bug, but is probably not the desired behavior. If you look at the end of the _save method in the Content_publish controller class you will see that it sets a ‘message_success’ flash message. This is probably overwriting the message you set earlier in your extension. If you are redirecting the user from inside your extension then that explains why it works in that scenario as it never reaches the end of the _save method.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.