#########################################################################################
## 
## Hack Title:    Option (yes/no) instead of input field
## Author:        Acid
##
## Description:   If you want to have an option (yes/no) instead of an input field..
##		  If you want to have several option fields duplicate the following
##		  steps and change "info" (be aware of the spelling).
##		  The field "info" is just an example.
##
## Files to edit: 5
##		  admin/admin_users.php
##		  includes/usercp_register.php
##		  includes/usercp_viewprofile.php
##                templates/xxx/admin/user_edit_body.tpl
##     	          templates/xxx/profile_add_body.tpl
##
#########################################################################################
## 
## Installation/Author Notes: 
## First always backup the files/database that you're going to edit. 
## 
## This hacks adds a new column to the 'user' table. 
## 
#########################################################################################
#
#-----[ SQL ]-------------------------------------------
#  
# You have to execute the following query via phpmyadmin (change prefix)..

# If you havent already added a new field..
ALTER TABLE phpbb_users ADD user_info VARCHAR(255) AFTER user_interests;

# If you want to change an existing field..
ALTER TABLE phpbb_users CHANGE user_info user_info TINYINT(1) default '0';

# If youre going to add/change several fields duplicate the above queries and 
# change the field names "user_info".
#
#########################################################################################
# 
#-----[ OPEN ]------------------------------------------ 
#  
# includes/usercp_viewprofile.php
# 
#-----[ FIND ]---------------------------------------------------
# 
	'INFO' => ( $profiledata['user_info'] ) ? $profiledata['user_info'] : '&nbsp;',

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
	'INFO' => ( $profiledata['user_info'] == '0' ) ? $lang['No'] : $lang['Yes'],



# 
#-----[ OPEN ]------------------------------------------
#  
# includes/usercp_register.php
# 
#-----[ FIND ]---------------------------------------------------
# 
	$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests', 'info' => 'info');

# 
#-----[ IN-LINE FIND and DELETE ]---------------------------------------------------
# 
, 'info' => 'info'

# 
#-----[ FIND (2x) and always DELETE ]-------------------------------------------
# 
		$info = stripslashes($info);

# 
#-----[ FIND ]---------------------------------------------------
# 
	$viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;

# 
#-----[ BELOW ADD ]---------------------------------------------------
# 
	$info = ( isset($HTTP_POST_VARS['info']) ) ? ( ($HTTP_POST_VARS['info']) ? TRUE : 0 ) : 0;

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, user_info = '" . str_replace("\'", "''", $info) . "'

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
, user_info = '$info'

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "INSERT INTO " . USERS_TABLE . "

# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, '" . str_replace("\'", "''", $info) . "'

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
, '$info'

# 
#-----[ FIND ]---------------------------------------------------
# 
		'INFO' => $info,

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
		'INFO_YES' => ( $info ) ? 'checked="checked"' : '',
		'INFO_NO' => ( !$info ) ? 'checked="checked"' : '',



# 
#-----[ OPEN ]------------------------------------------
#  
# admin/admin_users.php
# 
#-----[ FIND ]---------------------------------------------------
# 
		$info = ( !empty($HTTP_POST_VARS['info']) ) ? trim(strip_tags( $HTTP_POST_VARS['info'] ) ) : ''; 

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
		$info = ( isset( $HTTP_POST_VARS['info']) ) ? ( ( $HTTP_POST_VARS['info'] ) ? TRUE : 0 ) : 0;

# 
#-----[ FIND (2x) and always DELETE ]-------------------------------------------
# 
			$info = htmlspecialchars(stripslashes($info));


# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, user_info = '" . str_replace("\'", "''", $info) . "'

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
, user_info = '$info'

# 
#-----[ FIND ]---------------------------------------------------
# 
		$info = htmlspecialchars($this_userdata['user_info']);

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
		$info = $this_userdata['user_info'];

# 
#-----[ FIND ]---------------------------------------------------
# 
			$s_hidden_fields .= '<input type="hidden" name="info" value="' . str_replace("\"", "&quot;", $info) . '" />'; 

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
			$s_hidden_fields .= '<input type="hidden" name="info" value="' . $info . '" />';

# 
#-----[ FIND ]---------------------------------------------------
# 
			'S_INFO' => $s_info, 

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
			'INFO_YES' => ($info) ? 'checked="checked"' : '',
			'INFO_NO' => (!$info) ? 'checked="checked"' : '',



# 
#-----[ OPEN ]------------------------------------------
#  
# templates/xxx/admin/user_edit_body.tpl
# templates/xxx/profile_add_body.tpl
# 
#-----[ FIND ]---------------------------------------------------
# 
          <td class="row2"> <input class="post" type="text" name="info" size="35" maxlength="50" value="{INFO}" /> /td> 
# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
	  <td class="row2"> 
		<input type="radio" name="info" value="1" {INFO_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
		<input type="radio" name="info" value="0" {INFO_NO} />
		<span class="gen">{L_NO}</span></td>

#########################################################################################
#########################################################################################
#########################################################################################