MyBB Community Forums

Full Version: Custom hack, to add an extra tick box (and user parameter) on registration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

<span style="display:none;">

you can add the following example:

<br />
<fieldset class="trow2">
<legend><strong>Legal Background</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<td valign="top" width="1">
<input type="checkbox" class="checkbox" name="isqualified" id="isqualified" value="1"  />
<td valign="top" colspan="2">
<span class="smalltext">
<label for="isqualified">Are you a legal professional or do you have legal qualifications?</label>

3. Update member.php
at about line 117, change:
		"coppa_user" => intval($mybb->cookies['coppauser'])
		"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']),

$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))
add the following:
		if($this->method == "insert" || array_key_exists('isqualified', $user))

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
thx for sharing this ........