Skip to content

Instantly share code, notes, and snippets.

@tony2001
Created March 18, 2016 13:02
Show Gist options
  • Save tony2001/5244bf151dbfe016316f to your computer and use it in GitHub Desktop.
Save tony2001/5244bf151dbfe016316f to your computer and use it in GitHub Desktop.
diff --git a/application/classes/Controller/Page.php b/application/classes/Controller/Page.php
index ca1e866..8995ef1 100644
--- a/application/classes/Controller/Page.php
+++ b/application/classes/Controller/Page.php
@@ -40,20 +40,6 @@ abstract class Controller_Page extends Controller_Template {
parent::__construct($request, $response);
- $session = Session::instance();
- $alert = $session->get("last_alert");
- $alert_type = $session->get("last_alert_type");
- if (is_string($alert)) {
- if ($alert_type) {
- $this->set_alert($alert, $alert_type);
- } else {
- $this->set_alert($alert);
- }
-
- $session->delete("last_alert");
- $session->delete("last_alert_type");
- }
-
if (Auth::instance()->logged_in()) {
$this->user = Auth::instance()->get_user();
@@ -92,6 +78,20 @@ abstract class Controller_Page extends Controller_Template {
$this->script = $config->get('script', array());
$this->menu = Request::factory('menu/main');
+
+ $session = Session::instance();
+ $alert = $session->get("last_alert");
+ $alert_type = $session->get("last_alert_type");
+ if (is_string($alert)) {
+ if ($alert_type) {
+ $this->set_alert($alert, $alert_type);
+ } else {
+ $this->set_alert($alert);
+ }
+
+ $session->delete("last_alert");
+ $session->delete("last_alert_type");
+ }
}
public function after() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment