Browse Source

Added same fix for info messages as was implemented for error messages

develop
tswagger 10 years ago
parent
commit
6119213f19
  1. 29
      application/libraries/Aauth.php

29
application/libraries/Aauth.php

@ -20,8 +20,6 @@
* The latest version of Aauth can be obtained from: * The latest version of Aauth can be obtained from:
* https://github.com/emreakay/CodeIgniter-Aauth * https://github.com/emreakay/CodeIgniter-Aauth
* *
* @todo implement same fix for "info" as was implemented for "errors"
*
*/ */
class Aauth { class Aauth {
@ -80,8 +78,9 @@ class Aauth {
$this->CI->config->load('aauth'); $this->CI->config->load('aauth');
$this->config_vars = $this->CI->config->item('aauth'); $this->config_vars = $this->CI->config->item('aauth');
// load error messages from flashdata (but don't store back in flashdata) // load error and info messages from flashdata (but don't store back in flashdata)
$this->errors = $this->CI->session->flashdata('errors'); $this->errors = $this->CI->session->flashdata('errors');
$this->infos = $this->CI->session->flashdata('infos');
} }
@ -1711,7 +1710,7 @@ class Aauth {
/** /**
* Clear Errors * Clear Errors
* *
* Removes errors from error list and clears all flashdata * Removes errors from error list and clears all associated flashdata
*/ */
public function clear_errors() { public function clear_errors() {
$this->errors = []; $this->errors = [];
@ -1721,16 +1720,22 @@ class Aauth {
//tested //tested
/** /**
* Info * Info
*
* Add message to info array and set flash data * Add message to info array and set flash data
* @param string $message Message to add to array *
* @param string $message Message to add to infos array
* @param boolean $flashdata if true add $message to CI flashdata (deflault: true)
*/ */
public function info($message){ public function info($message = '', $flashdata = true){
$this->infos[] = $message; $this->infos[] = $message;
$this->CI->session->set_flashdata('infos', $this->errors); if($flashdata) {
$this->CI->session->set_flashdata('infos', $this->infos);
}
} }
//not working //not working
// NOTE: This should now be working
/** /**
* Keep Infos * Keep Infos
* keeps the flash data * keeps the flash data
@ -1780,6 +1785,16 @@ class Aauth {
echo $msg; echo $msg;
} }
/**
* Clear Info List
*
* Removes info messages from info list and clears all associated flashdata
*/
public function clear_errors() {
$this->infos = [];
$this->CI->session->set_flashdata('infos', $this->infos);
}
######################## ########################
# User Variables # User Variables
######################## ########################

Loading…
Cancel
Save