Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 11 Sep 2007, 21:14
Masked Crusader Masked Crusader is offline
 
Join Date: Oct 2005
Real name: Shane
Capitalize First Letter of a Profile Field

Hey guys.

This is what I need help with.

Say that I have a profile field 'field12'. What I need is plugin code that can check to see if the first letter of the user input is capitalized. If it is not, then go ahead and capitalize it. If it is, then do nothing.

I need it to check whenever a user registers and/or whenever they make a change to their profile field via their Profile in the User CP.

Any help would be GREATLY appreciated.

Thank you.
Reply With Quote
  #2  
Old 12 Sep 2007, 01:08
Farcaster Farcaster is offline
 
Join Date: Dec 2005
Real name: Robert Howard
I did a quick search and found this. This may work for you: http://www.techmocracy.net/wp-conten...e-function.txt
Reply With Quote
  #3  
Old 12 Sep 2007, 01:28
Masked Crusader Masked Crusader is offline
 
Join Date: Oct 2005
Real name: Shane
How would I implement that Farcaster?
Reply With Quote
  #4  
Old 12 Sep 2007, 01:49
Reeve of shinra's Avatar
Reeve of shinra Reeve of shinra is offline
 
Join Date: Oct 2001
When you create (or edit) a profile field, you have the option of using regex ... check out the regex syntax for capatializing the first letter.
Reply With Quote
  #5  
Old 12 Sep 2007, 16:41
Masked Crusader Masked Crusader is offline
 
Join Date: Oct 2005
Real name: Shane
Any idea on what the Regular Expression syntax would be for that field?

I have looked all over PHP.net and cannot find the syntax for capitalizing the first letter.

Thanks.

Well, I found a regular expression:

$string =~ s/\b(\w)/uc($1)/eg Capitalize first letter of all words in a string

However, even when I enter in the correct syntax in the profile field, it comes back at me with the same error as when I enter the wrong syntax in:

You did not enter the correct format for the Character Name field. Please read the field description for the expected format.

Last edited by Masked Crusader; 12 Sep 2007 at 16:58. Reason: Automerged Doublepost
Reply With Quote
  #6  
Old 12 Sep 2007, 17:00
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
Why not just use the ucfirst() function in PHP?

http://www.php.net/manual/en/function.ucfirst.php

For fields with multiple words then use ucwords().

http://www.php.net/manual/en/function.ucwords.php
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Reply With Quote
  #7  
Old 12 Sep 2007, 17:05
Masked Crusader Masked Crusader is offline
 
Join Date: Oct 2005
Real name: Shane
The field will only have one word.

However, where do I put the ucfirst() function?

Thanks.
Reply With Quote
  #8  
Old 12 Sep 2007, 17:24
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
In plugins.. Probably on the profile_updateprofile and register_form_complete hooks.
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Reply With Quote
  #9  
Old 12 Sep 2007, 17:29
Masked Crusader Masked Crusader is offline
 
Join Date: Oct 2005
Real name: Shane
And what is going between the parentheses in the plugin?

ucfirst(field12);

Is that right?
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Posting Features Auto-Capitalize First Letter of Each Word In Thread Title ZomgStuff vBulletin 3.6 Add-ons 37 18 Sep 2014 06:39
Capitalize First Letter in Thread Title TWTCommish vBulletin 2.x Full Releases 21 15 May 2004 08:44
Letter Statistics in Member Profile v1.0 Sho vBulletin 2.x Full Releases 18 09 Apr 2003 15:02



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 15:09.

Layout Options | Width: Wide Color: