Jump to content

how to check if $user->save(); worked correctly ?


Doc
 Share

Recommended Posts

Hi,

When I'm registering a user :

$u = new User();
$u->name = $username;
$u->pass = $password;
$u->addRole("guest");
$u->save();

... is there a way to tell that the user was correctly saved ?

Can I merely check with :

if ($user->id)
	// OK
else
	// KO

I'm asking that because when I'm registering a new user, I'm also saving that $user->id in another table.

So I'm wondering is there any clean way to check that, otherwise I'll use a basic check on the existence of $user->id.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...