I have the same problem since five months. I put this code in /modules/profiles/register.php:
$profile_handler =& xoops_gethandler('profile');
// Get fields
$mensaje="uname: ".$newuser->getVar('uname')."\n";
$mensaje.="loginname: ".$newuser->getVar('loginname')."\n";
$mensaje.="email: ".$newuser->getVar('email')."\n";
$mensaje.="pass: ".$newuser->getVar('pass')."\n";
$mensaje.="actkey: ".$newuser->getVar('actkey')."\n";
$mensaje.="user_regdate: ".$newuser->getVar('user_regdate')."\n";
$fields = $profile_handler->loadFields();
if (count($fields) > 0) {
foreach (array_keys($fields) as $i) {
$fieldname = $fields[$i]->getVar('field_name');
if ($fields[$i]->getVar('field_register') && isset($_POST[$fieldname])) {
$newuser->setVar($fieldname, $_POST[$fieldname]);
$mensaje.=$fieldname.": ".$newuser->getVar($fieldname).";\n";
}
}
}
$para =
'admin@dealmonte.com';
$asunto = 'Intento de registro';
mail($para, $asunto, $mensaje);
if (!$member_handler->insertUser($newuser)) {
$para =
'admin@dealmonte.com';
$asunto = 'Registro fallido en usuario';
$mensaje.="mysql_error: ".mysql_error().";\n";
mail($para, $asunto, $mensaje);
echo _PROFILE_MA_REGISTERNG;
echo implode('
', $newuser->getErrors());
break;
}
$newid = $newuser->getVar('uid');
if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
$para =
'admin@dealmonte.com';
$asunto = 'Registro fallido en grupo';
$mensaje.="mysql_error: ".mysql_error().";\n";
mail($para, $asunto, $mensaje);
echo _PROFILE_MA_REGISTERNG;
break;
}
But not always the e-mails are dispatched. I received this message for last registering:
uname: espaƱa
loginname: pruebaxx
email:
espaol2@dealmonte.compass: c893bad68927b457dbed39460e6afd62
actkey: 07c959f7
user_regdate: 1156849533
notify_method: 0;
attachsig: 1;
user_mailok: 1;
user_from: Almonte;
user_sig: ;
bio: ;
user_occ: ;
mysql_error: Duplicate entry '405' for key 1;
The row in xoops_users was ok, but in xoops_user_profile was wrong. The register date was 0, and other fields were with default value. And, there wasn't new records in xoops_group_users_links.
After, I deleted the new records for uid=405, I updated the autoincrement value to 405, and then I can register the new user with the same values.
As sometimes I don't receive the e-mails with the regisering data, I think is a problem of PHP. When this occurs, a new row is inserted in xoops_user_profile, with default values, but in tables xoops_users and xoops_group_users_links there aren't new rows.
Versions: XOOPS 2.2.4, PHP 4.4.2, MySQL 4.1.21-standard, Apache 1.3.37 (Unix)