I'm new to Craft and (attempting to) create a plugin so that I can import existing users from CSV.

I'm referencing this method:


In my function, I'm using the following code:

$user = craft()->users->getUserById(6);

Am I completely misunderstanding what this is supposed to do?


You shouldn't need to call changePassword() at all. Try this:

$user = craft()->users->getUserById(6);
$user->newPassword = 'mynewpassword123';

If it's not updating correctly, then there is likely a validation error somewhere. You can check that with:


Which will return an array of properties that failed validation and their error messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.