In the webform additional-processing field (PHP), I added this routine to create & notify a new user:
<?php
if (user_load(array('mail' => $form['#post']['submitted']['email'])) == FALSE) {
$newUser = array(
'name' => $form['#post']['submitted']['name'],
'pass' => user_password(), // note: do not md5 the password
'mail' => $form['#post']['submitted']['email'],
'status' => 1,
'init' => $form['#post']['submitted']['email'],
'roles' => array('4' => 'school')
);
$account = user_save(null, $newUser);
_user_mail_notify('register_no_approval_required', $account);
}
?>
Change the $form identifiers to your specific needs.
Hey! I'm a Druapl Newbie but this is EXACTLY what I need! Any way I can ask for your help in integrating this code with our Join Us form?
ReplyDeleteyou'll also need the webform_php module for this
ReplyDeleteC4VDGKO8Pos.. Amazing :)
ReplyDelete