How can I add more features on Registration form?

Temporary forum to obtain support while phpBB.com is offline.
Please use the support forum on phpBB.com
Forum rules
Temporary forum to obtain support while phpBB.com is offline.
Please use the support forum on phpBB.com
Locked
Legend Returnz
Registered User
Posts: 5
Joined: Fri Feb 06, 2009 3:09 pm

How can I add more features on Registration form?

Post by Legend Returnz »

How can I add more features on Registration form? Like: Location, Website, Occupation, Interests, Birthday

Legend Returnz
Registered User
Posts: 5
Joined: Fri Feb 06, 2009 3:09 pm

Re: How can I add more features on Registration form?

Post by Legend Returnz »

Please help somebody

Ricky_Racer
Registered User
Posts: 4
Joined: Mon Mar 12, 2007 11:48 am

Re: How can I add more features on Registration form?

Post by Ricky_Racer »

Too bad the normal forum is under maintenance, DavidIQ has mods posted there for Birthday & Location on registration. (I use them both)
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
Anyway here we go, DavidIQ's mods, and my best guess at the others, (Interests, Occupation, and Website).
The php part.

Code: Select all

#
#------[ OPEN ]-----------------------------------------------
#
includes/ucp/ucp_register.php
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
			'lang'				=> basename(request_var('lang', $user->lang_name)),
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
			'interests'			=> utf8_normalize_nfc(request_var('interests', 'user_interests', true)),
			'lang'				=> basename(request_var('lang', $user->lang_name)),
//-- add mod : location on registration v.1.0.1 [DavidIQ] ----------------------
			'location' 			=> utf8_normalize_nfc(request_var('location', '', true)),
//-- end add : location on registration v.1.0.1 [DavidIQ] ----------------------
			'occupation'			=> utf8_normalize_nfc(request_var('occupation', '', true)),
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
			'tz'				=> request_var('tz', (float) $timezone),
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
			'website'			=> request_var('website', '', true),
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
		// Check and initialize some variables if needed
		if ($submit)
		{
			$error = validate_data($data, array(
#
#------[ BEFORE, ADD ]----------------------------------------
#
# Tip: Add these lines on a new blank line before the preceding line(s) to find.
#
//-- add mod : birthday on registration v.1.0.0 [DavidIQ] ----------------------
		if ($config['allow_birthdays'])
		{
			$data['bday_day']      = $data['bday_month'] = $data['bday_year'] = 0;
			$data['bday_day']      = request_var('bday_day', $data['bday_day']);
			$data['bday_month']    = request_var('bday_month', $data['bday_month']);
			$data['bday_year']     = request_var('bday_year', $data['bday_year']);
			$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
		}
//-- end add : birthday on registration v.1.0.0 [DavidIQ] ----------------------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
				'tz'				=> array('num', false, -14, 14),
				'lang'				=> array('match', false, '#^[a-z_\-]{2,}$#i'),
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
				'interests'			=> array('string', true, 2, 500),
				'lang'				=> array('match', false, '#^[a-z_\-]{2,}$#i'),
//-- add mod : location on registration v.1.0.1 [DavidIQ] ----------------------
				'location' 			=> array('string', false, 2, 255),
//-- end add : location on registration v.1.0.1 [DavidIQ] ----------------------
				'occupation'			=> array('string', true, 2, 500),
				'tz'				=> array('num', false, -14, 14),
//-- add mod : birthday on registration v.1.0.0 [DavidIQ] ----------------------
				'user_birthday'		 	=> array('date', false),
//-- end add : birthday on registration v.1.0.0 [DavidIQ] ----------------------
				'website'			=> array(
					array('string', true, 12, 255),
					array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
					'user_inactive_time'	=> $user_inactive_time,
				);
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
					'user_inactive_time'	=> $user_inactive_time,
					'user_interests'	=> $data['interests'],
//-- add mod : location on registration v.1.0.1 [DavidIQ] ----------------------
					'user_from'		=> $data['location'],
//-- end add : location on registration v.1.0.1 [DavidIQ] ----------------------
					'user_occ'		=> $data['occupation'],
					'user_website'		=> $data['website'],
				);
//-- add mod : birthday on registration v.1.0.0 [DavidIQ] ----------------------
				if ($config['allow_birthdays'])
				{
					$user_row['user_birthday'] = $data['user_birthday'];
				}
//-- end add : birthday on registration v.1.0.0 [DavidIQ] ----------------------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
			'EMAIL_CONFIRM'		=> $data['email_confirm'],
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
			'INTERESTS'			=> $data['interests'],
//-- add mod : location on registration v.1.0.1 [DavidIQ] ----------------------
			'LOCATION'			=> $data['location'],
//-- end add : location on registration v.1.0.1 [DavidIQ] ----------------------
			'OCCUPATION'			=> $data['occupation'],
			'WEBSITE'			=> $data['website'],
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
			'S_UCP_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
			)
		);
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : birthday on registration v.1.0.0 [DavidIQ] ----------------------
		if ($config['allow_birthdays'])
		{
			$s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>';
			for ($i = 1; $i < 32; $i++)
			{
				$selected = ($i == $data['bday_day']) ? ' selected="selected"' : '';
				$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
			}
			$s_birthday_month_options = '<option value="0"' . ((!$data['bday_month']) ? ' selected="selected"' : '') . '>--</option>';
			for ($i = 1; $i < 13; $i++)
			{
				$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
				$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
			}
			$s_birthday_year_options = '';
			$now = getdate();
			$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
			for ($i = $now['year'] - 100; $i < $now['year']; $i++)
			{
				$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
				$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
			}
			unset($now);
			$template->assign_vars(array(
				'S_BIRTHDAY_DAY_OPTIONS'	=> $s_birthday_day_options,
				'S_BIRTHDAY_MONTH_OPTIONS'	=> $s_birthday_month_options,
				'S_BIRTHDAY_YEAR_OPTIONS'	=> $s_birthday_year_options,
				'S_BIRTHDAYS_ENABLED'		=> true,
			));
		}
//-- end add : birthday on registration v.1.0.0 [DavidIQ] ----------------------
Now the html part.

Code: Select all

#
#------[ OPEN ]-----------------------------------------------
#
# Tip: This may be used for any prosilver based style.
#
styles/prosilver/template/ucp_register.html
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
		<dd><select name="tz" id="tz" class="autowidth">{S_TZ_OPTIONS}</select></dd>
	</dl>
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
<!-- Start mod : birthday on registration v.1.0.0 -->
<!-- IF S_BIRTHDAYS_ENABLED -->
    <dl>
        <dt><label for="bday_day">{L_BIRTHDAY}:</label><br /><span>{L_BIRTHDAY_EXPLAIN}</span></dt>
        <dd>
            <label for="bday_day">{L_DAY}: <select name="bday_day" id="bday_day" style="width: 4em;">{S_BIRTHDAY_DAY_OPTIONS}</select></label> 
            <label for="bday_month">{L_MONTH}: <select name="bday_month" id="bday_month" style="width: 4em;">{S_BIRTHDAY_MONTH_OPTIONS}</select></label> 
            <label for="bday_year">{L_YEAR}: <select name="bday_year" id="bday_year" style="width: 6em;">{S_BIRTHDAY_YEAR_OPTIONS}</select></label>
        </dd>
    </dl>
<!-- ENDIF -->
<!-- Finish mod : birthday on registration v.1.0.0 -->
	<dl>
		<dt><label for="interests">{L_INTERESTS}:</label></dt>
		<dd><textarea name="interests" id="interests" class="inputbox" rows="3" cols="30">{INTERESTS}</textarea></dd>
	</dl>
<!-- Start mod : location on registration v.1.0.1 -->
	<dl>
		<dt><label for="tz">{L_LOCATION}:</label></dt>
		<dd><input type="text" name="location" id="location" maxlength="255" value="{LOCATION}" class="inputbox autowidth" /></dd>
	</dl>
<!-- Finish mod : location on registration v.1.0.1 -->
	<dl>
		<dt><label for="occupation">{L_OCCUPATION}:</label></dt>
		<dd><textarea name="occupation" id="occupation" class="inputbox" rows="3" cols="30">{OCCUPATION}</textarea></dd>
	</dl>
	<dl>
		<dt><label for="website">{L_WEBSITE}:</label></dt>
		<dd><input type="text" name="website" id="website" maxlength="255" value="{WEBSITE}" class="inputbox" /></dd>
	</dl>
#
#------[ OPEN ]-----------------------------------------------
#
# Tip: This may be used for any subsilver2 based style.
#
styles/subsilver2/template/ucp_register.html
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
	<td class="row2"><select name="tz">{S_TZ_OPTIONS}</select></td>
</tr>
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
<!-- Start mod : birthday on registration v.1.0.0 -->
<!-- IF S_BIRTHDAYS_ENABLED -->
<tr>
    <td class="row1"><b class="genmed">{L_BIRTHDAY}: </b><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}</span></td>
    <td class="row2"><span class="genmed">{L_DAY}:</span> <select name="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select> <span class="genmed">{L_MONTH}:</span> <select name="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select> <span class="genmed">{L_YEAR}:</span> <select name="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></td>
</tr>
<!-- ENDIF -->
<!-- Finish mod : birthday on registration v.1.0.0 -->
<tr> 
	<td class="row1" width="35%"><b class="genmed">{L_INTERESTS}: </b></td>
	<td class="row2"><textarea class="post" name="interests" rows="3" cols="30">{INTERESTS}</textarea></td>
</tr>
<!-- Start mod : location on registration v.1.0.1 -->
<tr>
	<td class="row1"><b class="genmed">{L_LOCATION}: </b></td>
	<td class="row2"><input type="text" name="location" id="location" maxlength="255" value="{LOCATION}" class="post" /></td>
</tr>
<!-- Finish mod : location on registration v.1.0.1 -->
<tr> 
	<td class="row1" width="35%"><b class="genmed">{L_OCCUPATION}: </b></td>
	<td class="row2"><textarea class="post" name="occupation" rows="3" cols="30">{OCCUPATION}</textarea></td>
</tr>
<tr> 
	<td class="row1" width="35%"><b class="genmed">{L_WEBSITE}: </b></td>
	<td class="row2"><input class="post" type="text" name="website" size="30" maxlength="255" value="{WEBSITE}" /></td>
</tr>
#
#------[ DIY INSTRUCTIONS ]-----------------------------------
#
# Tip : These are manual instructions that cannot be performed automatically.
#       You should follow these instructions carefully.
#
 At the Administration Control Panel "Purge" the cache, "Refresh" the template(s) you have been working with.
#
#------[ SAVE/CLOSE ALL FILES/UPLOAD/ENJOY !!! ]--------------------------------
#
# EoM
#
# You have finished the installation for this MOD.
# Upload all changed files to your website.
# If the installation went bad, simply restore your backed up files.
#
# EoF
# ..:: -= END =- ::..
Good Luck, and Happy phpBB`ing !!! :mrgreen:
Later, Rick.

Lucinka
Registered User
Posts: 2
Joined: Tue Feb 10, 2009 10:23 pm

Re: How can I add more features on Registration form?

Post by Lucinka »

Hy, I have a similar question, I need to add an element like "something about me" but it should be visible just for admins. It should be for admin decision if this person will be intake or not.

thanks

Ricky_Racer
Registered User
Posts: 4
Joined: Mon Mar 12, 2007 11:48 am

Re: How can I add more features on Registration form?

Post by Ricky_Racer »

Lucinka wrote:Hy, I have a similar question, I need to add an element like "something about me" but it should be visible just for admins. It should be for admin decision if this person will be intake or not.

thanks
You might give this a try activation justification v.1.0.1.

Lucinka
Registered User
Posts: 2
Joined: Tue Feb 10, 2009 10:23 pm

Re: How can I add more features on Registration form?

Post by Lucinka »

Ricky_Racer wrote:
You might give this a try activation justification v.1.0.1.
This page is not working - General Eror!

Ricky_Racer
Registered User
Posts: 4
Joined: Mon Mar 12, 2007 11:48 am

Re: How can I add more features on Registration form?

Post by Ricky_Racer »

Lucinka wrote: This page is not working - General Eror!
Odd, it is working for me, it was slower than usual though, maybe phpbb.com isn't back to 100% yet, maybe try back a little later, as it is the "Official" release topic. ;)

Locked