vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Capitalize First Letter of a Profile Field (https://vborg.vbsupport.ru/showthread.php?t=157601)

Masked Crusader 09-11-2007 08:14 PM

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.

Farcaster 09-12-2007 12:08 AM

I did a quick search and found this. This may work for you: http://www.techmocracy.net/wp-conten...e-function.txt

Masked Crusader 09-12-2007 12:28 AM

How would I implement that Farcaster?

Reeve of shinra 09-12-2007 12:49 AM

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.

Masked Crusader 09-12-2007 03:41 PM

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.

Wayne Luke 09-12-2007 04:00 PM

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

Masked Crusader 09-12-2007 04:05 PM

The field will only have one word.

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

Thanks.

Wayne Luke 09-12-2007 04:24 PM

In plugins.. Probably on the profile_updateprofile and register_form_complete hooks.

Masked Crusader 09-12-2007 04:29 PM

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
  • Page Generation 0.01137 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete