Halt registration when certain conditions are (not) met

Solutions

Do hook_form_alter for user registration form, and add extra validation function to the form using #validate like below.

$form['#validate'][] = 'extra_user_validation';

in function extra_user_validation set error after validation. So, that you can avoid the submit process and invoking hooks.

function extra_user_validation($form, &$form_state) {
   // Get the input values of registration form from $form_state['values']
   // Do validation & set error
}

That should work !

Tags: Users

Similar questions

Is there a module that displays a field only when a condition is met?
I am looking a module that will only display some fields if a condition is met. Basically only administrators or editors should be able to see those fields in the display. In editing mode it should be alright as only editors have the right to view those fields. I have checked the documenation for Conditional Fields module and Field Conditional Stat...
How to select nodes of a certain type, created by a certain user and which have reference field to a node equal a certain nid?
I need a function that lists nodes by following this logic: give me all nodes of a given type which are created by a given user and which have a node reference field referencing a given node id. Any ideas about such function (in PHP, not in Views) )?
Re-render current form in submit-hook under certain conditions
I have a form: With the form callback: And a submit callback: In above example code, I would want to render that form three times, the fourth time, values should be stored. Note that my actual code is a lot more complex and has more complex criteria then simply "the first three times"; just to avoid answers like "just copy-paste the form three time...
How to add a custom field which dynamically renders different output according to certain conditions?
I am writing a module which adds a new field. Similar to the serial module, the field cannot be changed or filled anyhow when creating a new node. I just want the field to create a different output according to certain conditions, for instance if the user has a certain role or not. For instance, when a user visits a node of a content type which has...
Disable delete button on a view under certain conditions
I'm very new to Drupal 7. I have an administration screen created in Views to edit/delete my custom content type called events. In my custom module, I'd like to disable the delete button under certain conditions. Is there any hook that I can use for this purpose? The reason I like to do this is to prevent users from deleting 'certain' events. Insid...
How to use Rules send an email with a list of nodes that fill certain conditions?
I would like to send an email everyday that has a list of nodes that are filtered by certain conditions. I think the Rules module would be a good place to start. Real Example: If this can be done with Rules, what event do you have it react to? I would guess the core functionality of it would be put in a component that rescheduled itself every 24 ho...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.