diff --git a/README.md b/README.md index b839e85..66c4d19 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,16 @@ sorry John you will be banned :( ```php $this->aauth->ban_user(3); ``` + +You can check if the user exists in the database based on the user's id + +```php +if($this->aauth->user_exsist_by_id(3)){ +//user exsist +}else{ +//user not exsist +} +``` Quick Start is done but thats not the end Take a look [detailed Documentation from wiki](https://github.com/emreakay/CodeIgniter-Aauth/wiki/_pages) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index d337a65..c8aa727 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -803,6 +803,25 @@ class Aauth { return FALSE; } + /** + * user_exsist_by_id + * Check if user exist by user id + * @param $user_id + * + * @return bool + */ + public function user_exsist_by_id( $user_id ) { + $query = $this->CI->db->where('id', $user_id); + + $query = $this->CI->db->get($this->config_vars['users']); + + if ($query->num_rows() > 0) + return TRUE; + else + return FALSE; + } + + /** * Get user id * Get user id from email address, if par. not given, return current user's id