Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
I was gonna add a dropdown to my custom field 4.

My intentions are to have the options, single, taken or dating

I know i still need to edit the register files, but for the public_edit_profile, I need to make sure im on the right track and not outta wack here.

Find This:
Code
if (($vars_registration{custom4_field_use} ne 'DEL') && ($vars_registration{customfield4} 

ne '')) {

if ($vars_registration{custom4_field_use} eq 'REQ') {
$B1 = '<b>';
$B2 = '</b>';
} else {
$B1 = '';
$B2 = '';
}
after it add this:
Code
if($user_profile[18] eq 'Single')
{
my $singleselect = qq! selected="selected"!;
} else {
my $singleselect = qq! !;
}

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


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

if($user_profile[18] eq '')
{
my $takenselect = qq! selected="selected"!;
} else {
my $takenselect = qq! !;
}
Find This:
Code
<input type="text" name="customfield4" value="$user_profile[19]" size="35" maxlength="80" />
Replace With:
Code
<select name="customfield4">
<option value="Single" $singleselect>$vars_wordlets_mods{single_option}</option>
<option value="Dating" $datingselect>$vars_wordlets_mods{dating_option}</option>
<option value="Taken" $takenselect>$vars_wordlets_mods{taken_option}</option>
</select>
and then in vars_wordlets_mods:
Code
q!single_option! => q!Single!,
q!dating_option! => q!Dating!,
q!taken_option! => q!Taken!,
Yes ? No ? Any help?

Sponsored Links
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
"my" scopes the variable to that block - you need to declare the variables using my outside of the if blocks.

Otherwise this looks like it should work...


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
outside? can u give me an example charles? Im all new to this stuff

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
instead of

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

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

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
It would probably be better to do it inline, now that I think about it:

Code
my $datingselect = ($user_profile[18] eq 'Dating' ?
qq! selected="selected"! : "");


UBB.classic: Love it or hate it, it was mine.
Sponsored Links
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
is user profile[18] right though too? Where can i find out what all the user profile numbers mean?

And do I do this same code in the registration files?

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
There's a nice guide at the bottom of cp2_membermanage. smile

The registration template is a far different animal than the edit template...


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ok so what about public_register_form

Find
Code
$vars_registration{customfield4}, "", "customfield4", "text", 35, 80, 0);
Replace with
Code
$vars_registration{customfield3}, "", "customfield3", "dropdown", { Single => $vars_wordlets_mods{single_option}, Dating => $vars_wordlets_mods{dating_option}, Taken => $vars_wordlets_mods{taken_option} }, [qw(Single Dating Taken)], Single);
I think theres gotta be more though?

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Actually Im just gonna use the radio button, its easier it seems

so now I have this

Code
my $singleselect;
if($user_profile[18] eq 'Single')
{
$singleselect = qq! selected="selected"!;
} else {
$singleselect = qq! !;
}
my $datingselect;
if($user_profile[18] eq 'Dating')
{
$datingselect = qq! selected="selected"!;
} else {
$datingselect = qq! !;
}

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

Code
<input type="radio" name="customfield4" value="Single" $singleselect /> 

$vars_wordlets_mods{single_option}

<input type="radio" name="customfield4" value="Dating" $datingselect />

$vars_wordlets_mods{dating_option}

<input type="radio" name="customfield4" value="Taken" $takenselect />

$vars_wordlets_mods{taken_option}
it works, however if u go back into ur profile, the radio buttons arnt checked. It doesnt save your setting. How do u make it do this?

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Change of plans

Need help Still

Code
if($user_profile[18] eq 'Single')
{
$datingselect = '';
$takenselect = '';
$singleselect = qq( checked="checked");

}
elsif($user_profile[18] eq 'Dating')
$singleselect = '';
$takenselect = '';
$datingselect = qq( checked="checked");

} else {
$singleselect = '';
$datingselect = '';
$takenselect = qq( checked="checked");
}

Sponsored Links
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
That looks right.........


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
too bad it doesnt work ;(

Whenever you go back in ur profile, TAKEN is always the default one selected. EVen if you select SINGLE

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Does the profile itself get updated properly?


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
seems to be. it just defaults back to "taken" every time u go back into the profile. Very strange

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Have it print $user_profile[18] somewhere on the page, just to verify that things have taken hold.


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
it prints out on the screen "male"


cuz I installed the male/female hack, from gizzy and ian spence ( wierd al )

https://www.ubbdev.com/ubbcgi/ultimatebb.cgi/topic/17/1020.html?

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Well, that explains that. You'll need to choose one of the other custom fields for this then...


UBB.classic: Love it or hate it, it was mine.
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Quote
Originally posted by Charles Capps:

Well, that explains that. You'll need to choose one of the other custom fields for this then...
No, Im using customfield4, for the dating thing. I used customfield3 for the male/female.

So it should work fine right?

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
havoq, your using custom field 3 here, and there, which screwed up your ouput.

Quote
Originally posted by havoq:

Ok so what about public_register_form

Find
Code
$vars_registration{customfield4}, "", "customfield4", "text", 35, 80, 0);
Replace with
Code
$vars_registration{customfield3}, "", "customfield3", "dropdown", { Single => $vars_wordlets_mods{single_option}, Dating => $vars_wordlets_mods{dating_option}, Taken => $vars_wordlets_mods{taken_option} }, [qw(Single Dating Taken)], Single);
I think theres gotta be more though?
First, here, you replaces the customfield 3 input with the custom field 4 code.

Custom field 4 is 19, my mod used custom field 3, 18

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
oooooooooooooooo, crap, didnt think about that.

Ok I'll try it with [19] and get back with you guys.

Thanks Ian!

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ok it works perfect now! But how would I make it so that NONE of the radio's are checked when you ENTER into your profile. Im making it an optional field. So basically now, the choice TAKEN is default selected, which means the member HAS TO CHOOSE a selection.

I want it so that NONE of the radio's are checked when you enter into your profile

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
nevermind, figured it out

I had to add this

Code
} elsif($user_profile[19] eq 'Taken')  {	

$singleselect = '';
$datingselect = '';
$takenselect = qq( checked="checked");
} else {

$singleselect = '';
$datingselect = '';
$takenselect = '';
}

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
That sounds about right. smile


UBB.classic: Love it or hate it, it was mine.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)