How to add special validation for some fields on signup form

From aMember Pro Documentation
Jump to: navigation, search

Add this code to site.php file:

Am_Di::getInstance()->hook->add(Am_Event::VALIDATE_SAVED_FORM, function (Am_Event_ValidateSavedForm $event) {
    $form = $event->getForm();
    $vars = $form->getValue();
    if (isset($vars['email']) && ($vars['email'] != 'test')) { // perform some validation
        $event->addError('Some Error Accured!');
    }
});