News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How can i access custom reg field during registration processing?

Started by homer09001, June 30, 2012, 03:43:42 PM

Previous topic - Next topic

homer09001

Im trying to run a custom query in subs-members.php as the forum processes a user registration, but my query needs a value provided in a custom field on the registration form.

So the question is how can i read that value?

Using SMF 2.0.2

Arantor

To achieve what, exactly?

At what stage of registration are you hoping to have that value?

homer09001

Basically my site create signature images on the fly, but it generates them based on an individuals custom settings, i store these settings in the database, what i am trying to do is create a new row of settings in the database when the user registers on the forum, one of the fields in the settings is the Unique Member ID for an online network which is a required field on the registration form.

So i want to create this row of settings when their user account on the forum is created.

Arantor

If you look in Register.php, you'll see this code:

// We'll do custom fields after as then we get to use the helper function!
if (!empty($_POST['customfield']))
{
require_once($sourcedir . '/Profile.php');
require_once($sourcedir . '/Profile-Modify.php');
makeCustomFieldChanges($memberID, 'register');
}


At this point, the values are in the database - but honestly you are not recommended to mess with that part of the process (since it's just reusing the profile code), instead query it from the smf_themes table at that point (since you'll have the new member's id) and can do whatever you need to do right then.

Essentially, SELECT value FROM smf_themes WHERE id_member = $memberID and variable = 'cust_fieldname' (but I know you know how to write mods and thus can properly use $smcFunc instead of just mashing the query in there)

homer09001

Thanks for the reply i'll have a fiddle see what i can come up with, thanks again.

Advertisement: