Welcome to Geeklog, Anonymous Thursday, January 23 2025 @ 02:56 pm EST
Geeklog Forums
Custom User Registration
Eddy
Anonymous
Thanks for that.
I wonder if anyone else has had any problems with the Custom User Reg Fields not processing when the SUBMIT button is pressed?! I've got my additional fields showing up as I had hoped (almost, but close enough) but when the user presses SUBMIT on the registration form, the details aren't saved and the new registration isn't processed. Does anyone have any ideas as to what could be causing this!?
Thanks
I wonder if anyone else has had any problems with the Custom User Reg Fields not processing when the SUBMIT button is pressed?! I've got my additional fields showing up as I had hoped (almost, but close enough) but when the user presses SUBMIT on the registration form, the details aren't saved and the new registration isn't processed. Does anyone have any ideas as to what could be causing this!?
Thanks
9
9
Quote
Eddy
Anonymous
(Sorry - this was meant to be added to my other thread on this subject)
10
12
Quote
Eddy
Anonymous
Quote by: Blaine
What does your CUSTOM_usersave and CUSTOM_userCheck functions look like?
Hi Blaine, usersave looks like this :
Text Formatted Code
/* Function called when saving the user profile. */function custom_usersave($uid) {
global $_TABLES;
$grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
$position = COM_applyFilter($_POST['cust_position'],true);
$fleet = COM_applyFilter($_POST['cust_fleet'],true);
$base = COM_applyFilter($_POST['cust_base'],true);
$fullname = COM_applyFilter($_POST['fullname']);
DB_query("UPDATE {$_TABLES['users']} SET fullname='$fullname' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET position='$position' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET fleet='$fleet' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET base='$base' WHERE uid='$uid'");
if ($grad_year > 0) {
DB_query("UPDATE {$_TABLES['localuserinfo']} SET grad_year='$grad_year' WHERE uid='$uid'");
}
}
And userCheck doesn't appear to be there..... Atleast not in lib_custom.php.
Cheers
14
9
Quote
Eddy
Anonymous
Quote by: Eddy
Hi Blaine, usersave looks like this :
function custom_usersave($uid) {
global $_TABLES;
$grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
$position = COM_applyFilter($_POST['cust_position'],true);
$fleet = COM_applyFilter($_POST['cust_fleet'],true);
$base = COM_applyFilter($_POST['cust_base'],true);
$fullname = COM_applyFilter($_POST['fullname']);
DB_query("UPDATE {$_TABLES['users']} SET fullname='$fullname' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET position='$position' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET fleet='$fleet' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET base='$base' WHERE uid='$uid'");
if ($grad_year > 0) {
DB_query("UPDATE {$_TABLES['localuserinfo']} SET grad_year='$grad_year' WHERE uid='$uid'");
}
}
And userCheck doesn't appear to be there..... Atleast not in lib_custom.php.
Cheers
Quote by: Blaine
What does your CUSTOM_usersave and CUSTOM_userCheck functions look like?
Hi Blaine, usersave looks like this :
Text Formatted Code
/* Function called when saving the user profile. */function custom_usersave($uid) {
global $_TABLES;
$grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
$position = COM_applyFilter($_POST['cust_position'],true);
$fleet = COM_applyFilter($_POST['cust_fleet'],true);
$base = COM_applyFilter($_POST['cust_base'],true);
$fullname = COM_applyFilter($_POST['fullname']);
DB_query("UPDATE {$_TABLES['users']} SET fullname='$fullname' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET position='$position' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET fleet='$fleet' WHERE uid='$uid'");
DB_query("UPDATE {$_TABLES['localuserinfo']} SET base='$base' WHERE uid='$uid'");
if ($grad_year > 0) {
DB_query("UPDATE {$_TABLES['localuserinfo']} SET grad_year='$grad_year' WHERE uid='$uid'");
}
}
And userCheck doesn't appear to be there..... Atleast not in lib_custom.php.
Cheers
Have now added the following in lib_custom.php
Text Formatted Code
/*** Check if it's okay to create a new user.
*
* Geeklog is about to create a new user with the given username and email
* address. This is the custom code's last chance to prevent that,
* e.g. to check if all required data has been entered.
*
* @param string $username username that Geeklog would use for the new user* @param string $email email address of that user
* @return string an error message or an empty string for "OK"
*
*/
function CUSTOM_userCheck ($username, $email)
{
$msg = '';
// Example, check that the full name has been entered
// and complain if it's missing
if (empty ($_POST['fullname'])) {
$msg = 'Please enter your full name!';
}
return $msg;
}
11
12
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Actually it's the CUSTOM_userCreate function thats is called on registeration to create the new record. The userSave is just doing a save but it also should first check if the user record is there and if not then do an insert.
Geeklog components by PortalParts -- www.portalparts.com
Geeklog components by PortalParts -- www.portalparts.com
12
12
Quote
Eddy
Anonymous
Quote by: Blaine
Cheers mate. Here's userCreate.Actually it's the CUSTOM_userCreate function thats is called on registeration to create the new record. The userSave is just doing a save but it also should first check if the user record is there and if not then do an insert.
Text Formatted Code
/* Create any new records in additional tables you may have added *//* Update any fields in the core GL tables for this user as needed */
/* Called when user is first created */
function custom_usercreate($uid) {
global $_TABLES;
$grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
$fleet = COM_applyFilter($_POST['cust_fleet'],true);
$position = COM_applyFilter($_POST['cust_position'],true);
$base = COM_applyFilter($_POST['cust_base'],true);
$fullname = COM_applyFilter($_POST['cust_fullname']);
// Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
DB_query("INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year) VALUES ('$uid', '$grad_year', '$fleet', '$position', '$base')");
DB_query("UPDATE {$_TABLES['users']} SET fullname = '$fullname' WHERE uid='$uid'");
return true;
}
9
9
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Do you really have a field grad_year in your form - I suspect you don't.
I also expect you are getting a SQL error in your error.log file. The insert SQL stmt describes two fields
"INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year)
and yet you are passing in five
'$uid', '$grad_year', '$fleet', '$position', '$base'
Also have you created the new table as defined by $_TABLES['localuserinfo'] with the correct structure :
Geeklog components by PortalParts -- www.portalparts.com
I also expect you are getting a SQL error in your error.log file. The insert SQL stmt describes two fields
"INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year)
and yet you are passing in five
'$uid', '$grad_year', '$fleet', '$position', '$base'
Also have you created the new table as defined by $_TABLES['localuserinfo'] with the correct structure :
Geeklog components by PortalParts -- www.portalparts.com
10
10
Quote
Eddy
Anonymous
Quote by: Blaine
"INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year)
and yet you are passing in five
'$uid', '$grad_year', '$fleet', '$position', '$base'
Also have you created the new table as defined by $_TABLES['localuserinfo'] with the correct structure :
Do you really have a field grad_year in your form - I suspect you don't.
I also expect you are getting a SQL error in your error.log file. The insert SQL stmt describes two fields
"INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year)
and yet you are passing in five
'$uid', '$grad_year', '$fleet', '$position', '$base'
Also have you created the new table as defined by $_TABLES['localuserinfo'] with the correct structure :
Hi Blaine,
Thanks for the continued support. What I've done is keep grad_year which was your 'example' and just changed all reference on the forms to read 'staff number' instead. So while it contains a staff number as opposed to a graduation year, I thought it easier to leave the fields/tables as grad_year.
I've added the extra fields in the insert SQL stmt and, as for the table, I'm confident that this is done correctly - I simply copied and amended slightly your own SQL dump from the zip.
I'll give it a bash now I've changed the SQL stmt and see what happens.
Cheers
10
10
Quote
All times are EST. The time is now 02:56 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content