Search the blog

ProcessWire’s LoginRegisterPro saves so much time when building a front-end user management system. One thing I’ve found odd about its default setup, however, is that the user can change their email after registration. I generally prefer to block this behaviour — especially if your users have to pass through a whitelist or some form of user moderation.

If you’d like to do the same use the follow hook to remove the email field from ProcessWire’s LoginRegisterPro profile form. This should be placed in the template you use to run LoginRegisterPro — and it should run before $modules->get('LoginRegisterPro')->execute().

					
$loginRegister = twire('wire')->modules->get('LoginRegisterPro');

$loginRegister->addHookAfter('LoginRegisterProProfile::build', function($event) {
	
    $form = $event->return; // InputfieldForm
    $field = $form->getChildByName('profile_email');
    if($field) $field->getParent()->remove($field); 
  
});					
				
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.