Customizing SMF > SMF Coding Discussion
Add new data values to smf_members d-base table
Labradoodle-360:
Not a problem, unfortunately I don't have time to write up the edits right now, someone might come along who could specify a little bit further. Definitely let me know if you have any more specific questions.
keyrocks:
Work in progress...
At this point, I am getting an Error message after submitting a registration:
"The database value you're trying to insert does not exist: member_id"
Here is where I am at so far:
1. Added to the smf_members d-base table:
--- Code: ---
lpcmemb_id int(10) unsigned NOT NULL DEFAULT '0',
eda_info varchar(100) NOT NULL DEFAULT '',
--- End code ---
2. Need some language values added to Themes/default/languages/index.english.php:
--- Code: ---<?php // DO NOT COPY this tag
$txt['lpc_name_info'] = '(actual, no nick-names)';
$txt['lpc_memb_id'] = 'LPC Membership ID';
$txt['lpc_eda'] = 'Electoral District';
$txt['lpc_eda_info'] = 'Example: 35065 - Ottawa-Vanier (ON)';
// DO NOT COPY this tag ?>
--- End code ---
3: Added to Themes/default/Register.template.php in function template_registration_form() in between the Username and Email fields:
--- Code: ---<?php // DO NOT COPY this tag
#---------------------------- New Fields May.09.12 -------------------------------------------------
// Label for LPC Member ID
echo '<dt><strong><label for="member_id"> '.$txt['lpc_memb_id'].':</label></strong></dt>';
// Member ID Field
echo '<dd>';
echo '<input type="text" name="member_id" id="member_id" size="10" tabindex="', $context['tabindex']++, '" value="', isset($context['lpcmemb_id']) ? $context['lpcmemb_id'] : '', '" class="input_text" />';
echo '</dd>';
// Label for EDA info - number/name/prov
echo '<dt><strong><label for="riding_info">
'.$txt['lpc_eda'].':</strong> '.$txt['lpc_eda_info'].'</label></dt>';
// EDA info Field
echo '<dd>';
echo '<input type="text" name="riding_info" id="riding_info" size="65" tabindex="', $context['tabindex']++, '" value="', isset($context['eda_info']) ? $context['eda_info'] : '', '" class="input_text" />';
echo '</dd>';
# --------------------------- End New Fields -------------------------------------------------------
// DO NOT COPY this tag ?>
--- End code ---
4. And, in Sources/Subs-Members.php, in function registerMember... within the $regOptions['register_vars'] array, added (under 'passwd' =>):
--- Code: ---<?php // DO NOT COPY this tag
'member_id' => $regOptions['lpcmemb_id'],
'eda_info' => $regOptions['eda_info'],
// DO NOT COPY this tag ?>
--- End code ---
It would appear that I need to define 'member_id' and 'eda_info' somewhere else so that they are recognized as valid d-base values for insert.
Would you have any hints? :)
Labradoodle-360:
Try id_member instead of member_id ;)
keyrocks:
--- Quote from: Labradoodle-360 on May 10, 2012, 01:16:27 PM ---Try id_member instead of member_id ;)
--- End quote ---
Tried that too, made no difference.
Labradoodle-360:
What is the value of "$regOptions['lpcmemb_id']"?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version