views:

59

answers:

1

I am attempting to make an authentication plugin. JUser::getInstance() takes one input, and it is supposed to be the id. Is there any way to get an instance of a User using some other indentifier? such as username, email etc.

+1  A: 

Probably there isnt any such method. But yes if you are sure that username or email are unique then you can modify your file user.php in libraries/joomla/user/ and add a method there.

getInstanceByEmail($email) {

 $query = "select id from jos_users where email=".email;
 // use the code to get the id;

return getInstance($id);

} // this is just a sample code of how it can be achieved,

sushil bharwani
Thanks, I don't know why I didn't think of that >.>
Rixius