View Full Version : Adding Custom Select Field To Profile
treszoks
Sun 21st Oct '01, 2:23pm
Someone asked for this and here it is. Hopefully the documentation is clear enough and I didn't miss anything. Post here with any problems and/or comments.
This hack adds a select field (dropdown menu) to the profile. *Make sure to backup everything first!*
AlkATRaZ
Mon 22nd Oct '01, 4:51pm
can you add form Textarea support plz!!
thank you!
treszoks
Mon 22nd Oct '01, 7:38pm
Here you go. Untested, but should work.
snyx
Mon 22nd Oct '01, 9:38pm
What is the difference between this and the other hack like it created by mutt (I think thats what his name was)
cooldude
Mon 22nd Oct '01, 11:37pm
thankx m8
treszoks
Mon 22nd Oct '01, 11:43pm
Mine only requires adding two templates and modifying a couple of lines in register.php and member.php and doesn't use text files that must be opened and read from.
AlkATRaZ
Wed 24th Oct '01, 10:17pm
thx a ton doode!
your the best ! =)
AlkATRaZ
Wed 24th Oct '01, 11:06pm
doh!
it works great, except for one thing:
when its displaying the custom textarea field in the Getinfo template (to view a members profile), the text thats entered in the textarea box doesnt have any linebreaks, so its displayed in one long line.
I know about a php function called "nl2br()" that is supposed to display multiline text with <br>'s instead of hidden carriege returns, BUT when I add it to getinfo_customfields, it doesnt do anything..
This is the code that I need to modify to display line breaks:
<tr>
<td bgcolor="$backcolor"><normalfont><b>$profilefield[title]</b></normalfont></td>
<td bgcolor="$backcolor"><normalfont>$profilefield[value] </normalfont></td>
</tr>
if you can help me at all, id really appreciate!
thx
-Colin
treszoks
Wed 24th Oct '01, 11:53pm
Assuming the linebreaks were added to the db:
In member.php find this in the "getinfo" action segment (should be around line 1200):
$profilefield[value]=$userinfo[$profilefieldname];
Change it to this:
if ($profilefieldname == "fieldX") //where X is the field number
{
$profilefield[value]=nl2br($userinfo[$profilefieldname]);
}
else
{
$profilefield[value]=$userinfo[$profilefieldname];
}
AlkATRaZ
Thu 25th Oct '01, 6:58pm
sweet thank you!
I just noticed one more little issue,
the max input for custom fields is 250 characters so if a user types more then that it cuts it off.. I've changed the max input value in the Admin CP to 1000 chars but it still cuts it off at 250, I guess vbb has an internal max of 250.
admin cp:
Maximum Input
- how many characters may a user enter into this field?
- maximum 250
Thank you very much for all of your help, I really appreciate it Treszoks.
pipi
Sun 28th Oct '01, 12:56pm
how to make it display in showthread.php? thanks
treszoks
Sun 28th Oct '01, 1:15pm
pipi, it depends on the field number but here's how you'd do it.
In the "postbit" template, just place this where you want it:
$post[fieldX]
where X is the number of the field
Seifer
Mon 29th Oct '01, 4:52am
I cannot follow those .txt attachments, so in a desperate need of these, I just copied the Gender Hack...only modified it and the upgrade.php file to create the appropriate tables. It worked fine for the Gender Hack, the modified Gender Hack, and I used it a third time for a third drop down. It probably takes long than this, but...eh...it works. I'm just an idiot and find the most complicated route to things...
:p
Turk Master
Mon 29th Oct '01, 6:47am
Hey guys can I get a working demo plz......
Palmer ofShinra
Mon 29th Oct '01, 7:16am
Originally posted by AlkATRaZ
sweet thank you!
I just noticed one more little issue,
the max input for custom fields is 250 characters so if a user types more then that it cuts it off.. I've changed the max input value in the Admin CP to 1000 chars but it still cuts it off at 250, I guess vbb has an internal max of 250.
Thank you very much for all of your help, I really appreciate it Treszoks. That's a database limit. Custom user fields are stored as type char(250).
This means the field can literally hold 250 characters and no more.
Even if you try to set it higher, it won't work, because the database is limited to 250.
It's not a VB inherent thing.
If you MUST have more space, you'll have to add a new table to the DB manually and set the type to mediumtext or something.
treszoks
Mon 29th Oct '01, 11:11am
I can write out better instructions if you tell me exactly what you need. What I did was write out a general form for all possibilities. How many fields do you want? How many of those are required if any?
Powered by vBulletin™ Version 4.0.0 Beta 4 Copyright © 2009 vBulletin Solutions, Inc. All rights