Advertisement:

Author Topic: How can i access custom reg field during registration processing?  (Read 1627 times)

Offline homer09001

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Male
    • DTH-Scripts
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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,951
Re: How can i access custom reg field during registration processing?
« Reply #1 on: June 30, 2012, 05:44:44 PM »
To achieve what, exactly?

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

Offline homer09001

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Male
    • DTH-Scripts
Re: How can i access custom reg field during registration processing?
« Reply #2 on: July 02, 2012, 12:30:05 PM »
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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,951
Re: How can i access custom reg field during registration processing?
« Reply #3 on: July 02, 2012, 03:47:11 PM »
If you look in Register.php, you'll see this code:

Code: [Select]
// 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)

Offline homer09001

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Male
    • DTH-Scripts
Re: How can i access custom reg field during registration processing?
« Reply #4 on: July 03, 2012, 04:52:16 AM »
Thanks for the reply i'll have a fiddle see what i can come up with, thanks again.