Clone wiki

FrontendUser / Register extensions and plugins

Registration extensions and plugins

Add default role

Set a default role during user registration. You need to hook before save() to get the changes saved!

$fu->addHookBefore('save', function($event) {
    $user = wire('fu')->userObj;

Additional Nickname

Because the username is sanitized as "username" all blank and special characters will be removed. Nickname could be a custom user template field to display the users name as given by the user during registration sanitized as text.

$fu->addHookBefore('save', function($event) {
    $form = wire('fu')->form;

    if(!count($form->getErrors())) {
        wire('fu')->userObj->nickname = $form->fhValue('username', 'text');