Skip to content

Commit

Permalink
Added clear_messages and clear_errors methods to the model. Added cle…
Browse files Browse the repository at this point in the history
…aring of deactivate message during registration process.
  • Loading branch information
benedmunds committed Apr 22, 2015
1 parent 20cc8fa commit 3cbb835
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/Ion_auth.php
Expand Up @@ -319,8 +319,13 @@ public function register($username, $password, $email, $additional_data = array(
return FALSE;
}

//deactivate so the user much follow the activation flow
$deactivate = $this->ion_auth_model->deactivate($id);

//the deactivate method call adds a message, here we need to clear that
$this->ion_auth_model->clear_messages();


if (!$deactivate)
{
$this->set_error('deactivate_unsuccessful');
Expand Down Expand Up @@ -360,7 +365,7 @@ public function register($username, $password, $email, $additional_data = array(
$this->set_message('activation_email_successful');
return $id;
}

}

$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful', 'activation_email_unsuccessful'));
Expand Down
37 changes: 37 additions & 0 deletions models/ion_auth_model.php
Expand Up @@ -2103,6 +2103,8 @@ public function set_message($message)
return $message;
}



/**
* messages
*
Expand Down Expand Up @@ -2149,6 +2151,23 @@ public function messages_array($langify = TRUE)
}
}


/**
* clear_messages
*
* Clear messages
*
* @return void
* @author Ben Edmunds
**/
public function clear_messages()
{
$this->messages = array();

return TRUE;
}


/**
* set_error
*
Expand Down Expand Up @@ -2210,6 +2229,24 @@ public function errors_array($langify = TRUE)
}
}


/**
* clear_errors
*
* Clear Errors
*
* @return void
* @author Ben Edmunds
**/
public function clear_errors()
{
$this->errors = array();

return TRUE;
}



protected function _filter_data($table, $data)
{
$filtered_data = array();
Expand Down

5 comments on commit 3cbb835

@vuletuanbt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you tell me what it mean in this code ??
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful', 'activation_email_unsuccessful'));
activation_email_unsuccessful . Is that function ??. if true, where i can find it ?

@benedmunds
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's calling a hook. See this article for more details on hooks:

http://codebyjeff.com/blog/2013/01/using-hooks-with-ion_auth

@vuletuanbt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help.

@vuletuanbt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, i look ur code, i find out somthing. So, can you show me flow of grogram in your code when you use _cache_user_in_group in in_group function

@benedmunds
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you're asking?

Please sign in to comment.