Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

get user id from email address

Dear All, 
I'm new to osTicket. May I know for v1.8, is there any function I can use to get the user id from user's email address? 

Many thanks for your help!

Best regards
Hai

Comments

  • any suggestion? 

    Best regards
    Hai
  • So currently in osT the clients email address is their user id.  So I'm not real sure what your trying to ask.  Please try asking your question in a different way.

  • So currently in osT the clients email address is their user id.  So I'm not real sure what your trying to ask.  Please try asking your question in a different way.
    Sorry for the confusion. I mean to get the client object from client's email address. Like the User::lookup method can get user object from the internal user id. 

    Thanks,


  • I'm not sure if there is a function that you can use or not (I presume that there is).  But you could do a SQL query against the database something like:

    SELECT user_id FROM ost_user_email WHERE address='user@email.com';

  • Thanks Notzier, 
    I created a function. 

     static function getUidByEmail($email) {
            $sql = "SELECT `user_id` FROM `ost_user_email`  WHERE `address` = ".db_input($email)." limit 1";
            if(($res=db_query($sql)) && db_num_rows($res)) $row = db_fetch_row($res);
            return $row[0];;
        }
    it seems work. 

    Thanks, 
Sign In or Register to comment.