<?php
function addNewUser($form) {
global $modx;
$groupid = 1; // id of the group you want to assign the user to
// create user using email as username
// can use a username form field instead if desired
$table = $modx->getFullTableName('web_users');
$fields = array('username' => $form['frEmail'],
'password' => $form['frLastname']
);
$modx->db->insert($fields,$table);
$uid = $modx->db->getInsertId();
// add user attributes
$table = $modx->getFullTableName('web_user_attributes');
$fields = array('internalKey' => $uid,
'fullname' => $form['frFirstame'] . ' ' . $form['frLastname'],
'email' => $form['frEmail'],
'phone' => $form['frPhone'],
'blocked' => 1,
'gender' => $form['frGender'],
'country' => $form['frCountry'],
'state' => $form['frState'],
'zip' => $form['frZip'],
);
$modx->db->insert($fields, $table);
// add user to group
$table = $modx->getFullTableName('web_groups');
$fields = array('webgroup' => $groupid,
'webuser' => $uid
);
$modx->db->insert($fields,$table);
return;
}
?>
THANK YOU!
Are you going to make a tutorial of your custom web-user registration?

trying to setup a basic event registration page. so essentially, user will "sign up" by entering their email, contact info, and the data is written to a table so that MODx admin can go in and export a list of people who’ve signed up. i looked into using eForm, but it doesn’t store data, just emails it so i wouldn’t be able to get a list of signups. i also looked into webloginpe, but i don’t want to track "web user" registration b/c it’s not necessary for the person to be recognized next time they sign up for an event.
has anyone done event registration before? i thought there was a snippet or plugin that would do it but i couldn’t find one. if not, any suggestions on how i might do this without using a 3rd party like constant contact?
thanks.