The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I want to have a profile field for Phone Numbers.
I want the phone numbers to be in the format (xxx) xxx-xxxx I'm curious on how I would do this. Thanks for the help Josh |
|
#2
|
||||
|
||||
|
See this in register.php and member.php:
Code:
// ENTER ANY CUSTOM FIELD VALIDATION HERE! Code:
#\([0-9]{3}\) [0-9]{3}-[0-9]{4}#
|
|
#3
|
|||
|
|||
|
Thanks, but wouldn't that REQUIRE them to enter in the correct format?
Is there a way so that they just enter 10 digits and it displays it like that? Thanks Josh |
|
#4
|
||||
|
||||
|
How do you expect them to enter it?
xxx xxx-xxxx xxxxxx-xxxx xxx xxx xxxx ?? |
|
#5
|
||||
|
||||
|
Probably just :
xxxxxxxxxx Satan |
|
#6
|
|||
|
|||
|
xxxxxxxxxx
Should be fine. I think it would be the easiest to format. Thanks josh |
|
#7
|
||||
|
||||
|
In register.php and member.php replace this:
Code:
$$varname=censortext($$varname);
// ENTER ANY CUSTOM FIELD VALIDATION HERE!
Code:
$$varname=censortext($$varname);
if ($profilefield['profilefieldid'] == XX and preg_match('#[0-9]{10}#', $$varname)) {
$$varname = '('.substr($$varname, 0, 3).') '.substr($$varname, 3, 3).'-'.substr($$varname, 6);
}
// ENTER ANY CUSTOM FIELD VALIDATION HERE!
|
|
#8
|
|||
|
|||
|
Thanks for the help, I'll give it a try.
Josh |
|
#9
|
||||
|
||||
|
Did it work?
Satan |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|