Drupal Registration Types?

Scenario: I’m about to work on a Drupal 6.x project and I want to place a check-box designator on the registration form which will tell me if someone is of a certain type of professional worker. If they check that, I would then like to make their registration attempt be required to be verified by a site admin (i.e. - if Anonymous registers and places a check on that designator, the admin would get an e-mail indicating such whereby the admin then needs to verify whatever the admin needs to verify based on their submitted values, albeit a phone number, real name, e-mail address; whatever.)

How could this be done?

I think I know how to add the field to the registration form that I need but how would I create the condition whereby an e-mail response is sent to me (the admin) if and only if a registration attempt has that designation value submitted as TRUE?

Any insight into this is very appreciated and please let me know if I’m too vague on any details here… Lots of this is still developing in my mind as I think more and more about it.

Pseudo code wise something along the lines of the below. This is only only pseudo code though meant to show the general concept.


/**
 * @implement hook_form_FROM_ID_alter
 */
mymodule_form_user_register_alter(&form,&form_state) {

	/**
	 * Add your checkbox
	 */
	 $form['mycheckbox'] = array(
	 	'#type'=> 'checkbox',
	 	'#title'=> 'The Title'
	 );
	 
	 /**
	  * Add custom submit handler
	  */
	  $form['#submit'][] = 'mymodule_user_register_submit';

}

/**
 * Custom submit handler for user registration form.
 */
function mymodule_user_register_submit(&$form,&$form_state) {
	
	if(isset($form_state['values']['mycheckbox']) && !empty($form_state['values']['mycheckbox'])) {
		// send the email
	}
	
}

In short use hook_form_FROM_ID_alter to modify the structure of the default user registration form. Most importantly add a custom submit routine so that when the form is submitted without validation errors the email can be sent without modifying core code. Most likely much to it with all the details filled in but that is the gist of it.

Sorry for being late to the party… September has really had me hopping at work being the first week of everyone getting back to work around here.

Have you thought to use rules?

I haven’t investigated but it should be a rule or an action or even rules, actions with a helper module… I did something like this a few years ago, I’ll see if I can find my notes.

I think it would require some experimentation to figure out if you set all registrations to require moderation and then allow those without the specific checkbox to get in automatically and send the hello message or whether you allow all to register without moderation and then use rules to identify that checkbox and hold them back if it it the specific value. I’m leaning towards the latter… I think it would be easier to do and more fluid.

I’ll see if I can dig up my notes… It was an experiment and not exactly what your after but I built a helper that worked with rules or actions, I don’t recall which at the moment and it never went into production so I don’t really recall.

Andrew

oddz, I’ll give your idea a try but I do you think it’s possible with “Rules”?

Andrew, I did in fact check out that module–think I might try that first so that I don’t have to make a module (not that oddz’s idea isn’t in my ability level or something–just didn’t want to go down that route if I didn’t have to.)

I didn’t really think about rules. Haven’t done anything with them really though I do know about them. However, I’m not afraid to dig into code and by doing so can eliminate module dependencies which can get out of control at times for really simple things if you were to just write custom code.