Could anyone help me with this one? I have a custom plugin which needs to update a user's custom field with a particular value if they've filled out something on the registration form.
I believe the code below would work but it's running 44 times which is causing a nesting level error with xdebug.
Could anyone tell me why it would be running 44 times on a simple /users/saveUser post request with the below hook?
talentJobFamily and talentStage are both custom fields.
public function init()
{
craft()->on('users.onSaveUser', function (Event $event)
{
$user = $event->params['user'];
if ($user->talentJobFamily->value != '') {
$user->getContent()->setAttributes([
'talentStage' => 'engage',
]);
craft()->users->saveUser($user);
}
});
}