Forums / Developer / Help testing for user

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Help testing for user

Author Message

Graham Tillotson

Thursday 14 October 2004 1:57:25 pm

I'm working on an extension and could use help testing for the existence of a user. Here is what I'm trying to do:

$user =& $userClass->fetchByEmail($emailAddress);
// if user not found, then create

Any help on this would be appreciated. My PHP is a bit weak.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Björn X

Thursday 14 October 2004 3:18:35 pm

from eZUser you can read

    function &fetchByEmail( $email, $asObject = true )
    {
        $user =& eZPersistentObject::fetchObject( eZUser::definition(),
                                                  null,
                                                  array( 'email' => $email ),
                                                  $asObject );
        return $user;
    }

so

$user =& eZUser::fetchByEmail( $email ); 

have fun coding