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()
{
parent::actionSaveUser();
$this->renderTemplate('profile/index.html');
}
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
Update
Looking through the UserController::actionSaveUser action, I can see
craft()->urlManager->setRouteVariables(array(
'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?