From 2015e32e3bd6922d0697a875ecdc810243c887f0 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 13 Jul 2013 22:29:12 +0200 Subject: duser: add get_email() Signed-off-by: Florian Pritz --- application/libraries/Duser/drivers/Duser_db.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'application/libraries/Duser/drivers') diff --git a/application/libraries/Duser/drivers/Duser_db.php b/application/libraries/Duser/drivers/Duser_db.php index 48fbc007d..1258ec585 100644 --- a/application/libraries/Duser/drivers/Duser_db.php +++ b/application/libraries/Duser/drivers/Duser_db.php @@ -12,7 +12,8 @@ class Duser_db extends Duser_Driver { public $optional_functions = array( 'username_exists', 'can_reset_password', - 'can_register_new_users' + 'can_register_new_users', + 'get_email', ); public function login($username, $password) @@ -60,4 +61,21 @@ class Duser_db extends Duser_Driver { } } + public function get_email($userid) + { + $CI =& get_instance(); + + $query = $CI->db->query(" + SELECT email + FROM users + WHERE id = ? + ", array($userid))->row_array(); + + if (empty($query)) { + show_error("Failed to get email address from db"); + } + + return $query["email"]; + } + } -- cgit v1.2.3-24-g4f1b