![]() |
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. |
I did a quick search and found this. This may work for you: http://www.techmocracy.net/wp-conten...e-function.txt
|
How would I implement that Farcaster?
|
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.
|
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. |
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 |
The field will only have one word.
However, where do I put the ucfirst() function? Thanks. |
In plugins.. Probably on the profile_updateprofile and register_form_complete hooks.
|
And what is going between the parentheses in the plugin?
ucfirst(field12); Is that right? |
All times are GMT. The time now is 01:13 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|