I'm trying to extend the Craft UserController class, in order to add some extra validation to the actionSaveUser action, before the rest of the code in that function executes.

I've got no problem hitting my controller and even calling the parent::actionSaveUser which seems to be working, except for getting the validation error messages.

function actionSaveUser()

For brevity, I've not included any of the validation just yet. The template being rendered does display errors if routed to the Craft controller action, but not through mine.

The main reason for doing this is because uploading of a non-image for the profile image (e.g. uploading a php file) causes a php error, not a value in the returned errors array.

Any idea why the errors are disappearing when routing through my controller first?

Thank you in advance


Looking through the UserController::actionSaveUser action, I can see

    'account' => $user

Looking through the urlManager documentation; I can see that _routeVariables is being updated but can't see a way of accessing this array to get the account value.

Am I looking in the wrong place?

Update The Second

Ok, even sending the form directly to users/saveUser isn't yielding any errors (account object isn't defined). But, if all fields are filled in, it correctly saves

Any suggestions?

2 Answers 2


While not a direct answer to your question, as of the next (post 2.4.2702) Craft release, Craft will now return a validation error on the UserModel if a non-image is uploaded for the user's profile photo.


After a lot of head-desking, and some input from a colleague, we realised the issue wasn't in the controller but in the form action declaration. I originally had

<form action="pluginname/controller/action"...

Changing it to this, seems to have resolved it.

    <input type="hidden" name="action" value="pluginname/controller/action">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.