From c80bd1084d2361440553143df15c59c6c7a2d70c Mon Sep 17 00:00:00 2001 From: Dawid Myszczyszyn Date: Fri, 31 Oct 2014 23:39:55 +0000 Subject: [PATCH 1/3] Added two new function: user_exsist_by_id() and user_exsist_by_email() --- README.md | 19 +++++++++++++++++ application/libraries/Aauth.php | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/README.md b/README.md index b839e85..e8d71ae 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,25 @@ 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 email address + +```php +if($this->aauth->user_exsist_by_email('user@domain.tld')){ +//user exsist +}else{ +//user not exsist +} +``` +or user 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..85e6769 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -803,6 +803,42 @@ 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; + } + + /** + * user_exsist_by_email + * Check if user exsist by user email + * @param $user_email + * + * @return bool + */ + public function user_exsist_by_email( $user_email ) { + $query = $this->CI->db->where('email', $user_email); + + $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 From 4491a030861ca71aeff0ed041988ef531247cfa7 Mon Sep 17 00:00:00 2001 From: Dawid Myszczyszyn Date: Sun, 2 Nov 2014 03:33:36 +0000 Subject: [PATCH 2/3] Update README.md removed already existing functions --- README.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index e8d71ae..66c4d19 100644 --- a/README.md +++ b/README.md @@ -165,16 +165,7 @@ sorry John you will be banned :( $this->aauth->ban_user(3); ``` -You can check if the user exists in the database based on the user's email address - -```php -if($this->aauth->user_exsist_by_email('user@domain.tld')){ -//user exsist -}else{ -//user not exsist -} -``` -or user id +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)){ From 6b1723e95a4d1c96fa40ed4ef129055133a7e9bc Mon Sep 17 00:00:00 2001 From: Dawid Myszczyszyn Date: Sun, 2 Nov 2014 03:34:11 +0000 Subject: [PATCH 3/3] removed already existing functions --- application/libraries/Aauth.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 85e6769..c8aa727 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -821,23 +821,6 @@ class Aauth { return FALSE; } - /** - * user_exsist_by_email - * Check if user exsist by user email - * @param $user_email - * - * @return bool - */ - public function user_exsist_by_email( $user_email ) { - $query = $this->CI->db->where('email', $user_email); - - $query = $this->CI->db->get($this->config_vars['users']); - - if ($query->num_rows() > 0) - return TRUE; - else - return FALSE; - } /** * Get user id