Skip to content

Commit

Permalink
Added same fix for info messages as was implemented for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tswagger committed Feb 14, 2015
1 parent 1707579 commit 6119213
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
* The latest version of Aauth can be obtained from:
* https://github.com/emreakay/CodeIgniter-Aauth
*
* @todo implement same fix for "info" as was implemented for "errors"
*
*/
class Aauth {

Expand Down Expand Up @@ -80,8 +78,9 @@ public function __construct() {
$this->CI->config->load('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->infos = $this->CI->session->flashdata('infos');
}


Expand Down Expand Up @@ -1711,7 +1710,7 @@ public function print_errors($divider = '<br />'){
/**
* 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() {
$this->errors = [];
Expand All @@ -1721,16 +1720,22 @@ public function clear_errors() {
//tested
/**
* Info
*
* 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->CI->session->set_flashdata('infos', $this->errors);
if($flashdata) {
$this->CI->session->set_flashdata('infos', $this->infos);
}
}

//not working
// NOTE: This should now be working
/**
* Keep Infos
* keeps the flash data
Expand Down Expand Up @@ -1779,6 +1784,16 @@ public function print_infos($divider = '<br />'){
}
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
Expand Down

0 comments on commit 6119213

Please sign in to comment.