2011-06-12, 01:53 PM
Custom hack, to add an extra tick box (and user parameter) on registration
This is a custom hack, so use it at your own risk
1. Update the database, and add an extra column to the user table
(in my example, I added an extra 0 default int column called isqualified -- make sure this is all lower case)
2. Update the template: member_register
under:
you can add the following example:
3. Update member.php
at about line 117, change:
4. update user.php
at about line 965, change:
to:
This so far should work, but you might also want to validate the options for security/sanity checking:
5.(optional) Update validate_user in user.php:
855, under:
then at about line 114, add the validatie function, for example:
-its upto to then play with this $user parameter
This is a custom hack, so use it at your own risk
1. Update the database, and add an extra column to the user table
(in my example, I added an extra 0 default int column called isqualified -- make sure this is all lower case)
2. Update the template: member_register
under:
<span style="display:none;">
{$referrer}
</span>
you can add the following example:
<br />
<fieldset class="trow2">
<legend><strong>Legal Background</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<tr>
<td valign="top" width="1">
<input type="checkbox" class="checkbox" name="isqualified" id="isqualified" value="1" />
</td>
<td valign="top" colspan="2">
<span class="smalltext">
<label for="isqualified">Are you a legal professional or do you have legal qualifications?</label>
</span></td>
</tr>
3. Update member.php
at about line 117, change:
"coppa_user" => intval($mybb->cookies['coppauser'])
);
to: "coppa_user" => intval($mybb->cookies['coppauser']),
// custom hack for isqualified on registration page
"isqualified" => $mybb->input['isqualified']
);
4. update user.php
at about line 965, change:
$this->user_insert_data = array(
"username" => $db->escape_string($user['username']),
to:
$this->user_insert_data = array(
"username" => $db->escape_string($user['username']),
"isqualified"=> $db->escape_string($user['isqualified']),
This so far should work, but you might also want to validate the options for security/sanity checking:
5.(optional) Update validate_user in user.php:
855, under:
if($this->method == "insert" || array_key_exists('usertitle', $user))
{
$this->verify_usertitle();
}
add the following: if($this->method == "insert" || array_key_exists('isqualified', $user))
{
$this->verify_isqualified();
}
then at about line 114, add the validatie function, for example:
function verify_isqualified()
{
global $mybb;
$isqualified = &$this->data['isqualified'];
// Check if the usertitle is of the correct length.
if(my_strlen($usertitle) > 1)
{
$this->set_error('invalid_isqualified_length', '1');
return false;
}
return true;
}
-its upto to then play with this $user parameter