php forum
php mysql forum
php mysql smarty
 
Topic Options
#115560 - 08/25/03 05:55 AM Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
I'm wanting to make customfield3 into a dropdown which states:

Code:
Select
------
Male
Female
and i want it to require users to select one or the other (using values i know, but making the form is what i'm having issues with since i viewed presant options).

I'd also like to have it so that it's required as well in the followign areas:
cp edit profile (cp_edit_profile.pl)
public edit profile (public_edit_profile.pl)
registrations (public_register_form.pl)

note that the file names canbe off a bit since i'm running on 0 sleep...

Any help would be greatly appreciated.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115561 - 08/26/03 03:28 PM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Ok, so far I have:

Replace:
Code:
input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
With:
Code:
<select name="customfield3">
  <option>$vars_wordlets_mods{gender_select}</option>
  <option>$vars_wordlets_mods{gender_selector}</option>
  <option value="Male">$vars_wordlets_mods{gender_male}</option>
  <option value="Female">$vars_wordlets_mods{gender_female}</option>
</select></select>
Which sets the profile field to male or female, BUT, how would i go about making it have one selected when viewed in edit profile lol, it just shows "select"
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115562 - 08/26/03 03:42 PM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
try using...

Code:
if($user_profile[16] eq 'Male') {
	my $maleselect = qq! selected="selected"!;
} else {
	my $maleselect = qq! !;
}

if($user_profile[16] eq 'Female') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}

if($user_profile[16] eq '') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}

<select name="customfield3">
  <option>$vars_wordlets_mods{gender_select}</option>
  <option>$vars_wordlets_mods{gender_selector}</option>
  <option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
  <option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>
(note: I made it default to female to avoid being a chauvenist pig. gotta love the times we live in frown )

Top
#115563 - 08/26/03 05:43 PM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
where do i put the if/else statements?
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115564 - 08/26/03 05:43 PM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
oh, and you could have made "select" the default statement :x...
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115565 - 08/26/03 05:57 PM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
FIND:
=====
Code:
<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
REPLACE WITH:
==============
Code:
if($user_profile[18] eq 'Male') {
	my $maleselect = qq! selected="selected"!;
} else {
	my $maleselect = qq! !;
}

if($user_profile[18] eq 'Female') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}

if($user_profile[18] eq '') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}

<select name="customfield3">
  <option>$vars_wordlets_mods{gender_select}</option>
  <option>$vars_wordlets_mods{gender_selector}</option>
  <option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
  <option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>

Top
#115566 - 08/26/03 06:10 PM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
new gameplan, now that I looked at the file shocked

FIND:
=====
Code:
if (($vars_registration{custom4_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

	if ($vars_registration{custom3_field_use} eq 'REQ') {
		$B1 = '<b>';
		$B2 = '</b>';
	} else {
		$B1 = '';
		$B2 = '';
	}
ADD AFTER:
==========
Code:
if($user_profile[18] eq 'Male') {
	my $maleselect = qq! selected="selected"!;
} else {
	my $maleselect = qq! !;
}

if($user_profile[18] eq 'Female') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}

if($user_profile[18] eq '') {
	my $femaleselect = qq! selected="selected"!;
} else {
	my $femaleselect = qq! !;
}
THEN FIND:
==========
Code:
<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
AND REPLACE IT WITH:
====================
Code:
<select name="customfield3">
  <option>$vars_wordlets_mods{gender_select}</option>
  <option>$vars_wordlets_mods{gender_selector}</option>
  <option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
  <option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>
try that

Top
#115567 - 08/26/03 06:29 PM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
just shows dropdown, doesn't select users...

u. test
p. tester
url: http://www.undergroundnews.com/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=edit_my_profile
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115568 - 08/26/03 06:53 PM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
ratio buttons, dropdown, so long as it works :x...
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115569 - 09/06/03 05:31 AM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
:bump:
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115570 - 09/06/03 10:44 AM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
ok, here we go.

Code:
in public_edit_profile.pl

find:
<input type="text" name="customfield2" value="$user_profile[17]" size="35" maxlength="80" />
</td>
</tr>

THISFIELD

}    # end field

add after:

if($user_profile[18] eq 'Female') {
	$male_yes = '';
	$male_no = qq( checked="checked");
} else {
	$male_no = '';
	$male_yes = qq( checked="checked");
}

find:

<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />

replace with:

<input type="radio" name="customfield3" value="Male" $male_yes /> $vars_wordlets_mods{male_option} 

<input type="radio" name="customfield3" value="Female" $male_no /> $vars_wordlets_mods{female_option}

Also, just for cosmetic purposes...

find:

<td>
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$B1$vars_registration{customfield3}$B2:

replace with:

<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$B1$vars_registration{customfield3}$B2:

in vars_wordlets_mods.cgi

find:
%vars_wordlets_mods = (

add after:

	q!female_option! => q!Female!,
	q!male_option! => q!Male!,
that should do it. It defaults to Male.

Top
#115571 - 09/06/03 11:19 AM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
ok, you just asked for public_register_form.pl so here

Code:
find:
	$vars_registration{customfield3}, "", "customfield3", "text", 35, 80, 0);

replace with:

	$vars_registration{customfield3}, "", "customfield3", "radio", { Male => $vars_wordlets_mods{male_option}, Female => $vars_wordlets_mods{female_option} }, [qw(Male Female)], Male);

Top
#115572 - 09/06/03 11:42 AM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Sweet, with adding that in, and tweaking the positioning of custom3, i have a very nice outlook smile ... Thanks al wink ...
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115573 - 09/06/03 01:03 PM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
you can try this for the cp.

Code:
in cp_edit_profile.pl
find:
if (($vars_registration{custom3_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

	if ($vars_registration{custom3_field_use} eq 'REQ') {
		$B1 = '<b>';
		$B2 = '</b>';
	} else {
		$B1 = '';
		$B2 = '';
	}

	&AlternateColors;

	print <<THISFIELD;

<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title" style="font-weight: normal;">
$B1$vars_registration{customfield3}$B2:
</td><td class="autorow"><span class="autorow-options">
<INPUT TYPE="TEXT" NAME="customfield3" value="$user_profile[18]" SIZE="35" MAXLENGTH="80">
</span></td>
</tr>
THISFIELD

}    # end field

replace with:

if($user_profile[18] eq 'Female') {
	$male_yes = '';
	$male_no = qq( checked="checked");
} else {
	$male_no = '';
	$male_yes = qq( checked="checked");
}

if (($vars_registration{custom3_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

	if ($vars_registration{custom3_field_use} eq 'REQ') {
		$B1 = '<b>';
		$B2 = '</b>';
	} else {
		$B1 = '';
		$B2 = '';
	}

	&AlternateColors;

	print <<THISFIELD;

<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title" style="font-weight: normal;">
$B1$vars_registration{customfield3}$B2:
</td><td class="autorow"><span class="autorow-options">
<input type="radio" name="customfield3" value="Male" $male_yes /> $vars_wordlets_mods{male_option} 

<input type="radio" name="customfield3" value="Female" $male_no /> $vars_wordlets_mods{female_option}
</span></td>
</tr>
THISFIELD

}    # end field
smile

Top
#115574 - 10/27/03 11:42 AM Re: Making customfield3 into a dropdown?
Gizmo Online   shocked

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Hey al, how about that cp mod for 6.6.1?
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#115575 - 10/27/03 11:56 AM Re: Making customfield3 into a dropdown?
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
I'll look into it like Fridayish. I've got 2 essays to write frown

Top



Moderator:  Gizmo, tackaberry 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks