vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Force first Letter to be Capitilized in userfields? (https://vborg.vbsupport.ru/showthread.php?t=265393)

Wonksta 06-18-2011 03:23 AM

Force first Letter to be Capitilized in userfields?
 
Hi there,

Wondering if there is anyway to make it so that when a user inputs their Location the first letter is captilized?
E.g.

Location: Sydney instead of sydney or SYDNEY

Sarteck 06-18-2011 07:41 AM

I'm not COMPLETELY sure, since I don't do vB3 anymore, and so I can't test.... But you could try this on the profile_updateprofile hook:

PHP Code:

$my_location_field 'field2'/// NOTE -- Edit this if yours is different.
$location_data_entered $vbulletin->GPC['userfield'][$my_location_field];
$new_location ucwords($location_data_entered);
$vbulletin->GPC['userfield'][$my_location_field] = $new_location;
$userdata->set_userfields($vbulletin->GPC['userfield']); 

That will also take into consideration spaces. For example, if I put "SOMEWHERE IN HELL" as my location, it would change it to "Somewhere In Hell". Of course, "In" should not be capitalized grammatically, heh.




I've not tested this (I don't have vB3, and though it should (in theory) also work on vB4, I'm just too lazy to try it out. XP

Wonksta 06-18-2011 07:53 AM

Thanks mate I went to go try it but I cannot find 'profile_updateprofile' under Manage Plugs -> Plug Manager

/n00b

Sarteck 06-18-2011 08:01 AM

Serious? I thought it would be there... It's on line 1,885 of the vB 3.8.7 profile.php page, as ($hook = vBulletinHook::fetch_hook('profile_updateprofile') ) ? eval($hook) : false;

:(

Sorry I couldn't have been more help.



(Just to be sure we're on the same page, you are choosing to "Add New Plugin" and choosing the profile_updateprofile from the drop-down menu, ya?)

Wonksta 06-18-2011 08:09 AM

Ahh no we were not on the same page, thanks mate I will try this shortly I must head out now.

Thanks so much!

Sarteck 06-18-2011 08:14 AM

Don't thank me until it actually works. XD

Also not that it will not change whatever you have in there already, if it does work--this will only work when someone enters new data.

(If it works at all.)

Wonksta 06-18-2011 12:11 PM

Tried it now and it doesn't seem to work, bummer!

When the plugin is activated it wont let the user proceed to save the data because it says something else in another field is invalid even though fieldid is correct in the hook it messes with my other custom fields (drop down).

Ahh well!

Sarteck 06-18-2011 12:28 PM

There's probably just something wrong with my coding. Hopefully someone else looking at this will be able to point it out, but I just don't know right now. If I'm bored later on, I'll give it a try on my own forum.

EDIT: Even though I'm vB4, it'll probably work the same. That section of the code seems to be the same for both 3.8.7 and 4.1.4.

Wonksta 06-18-2011 12:29 PM

Quote:

Originally Posted by Sarteck (Post 2209437)
There's probably just something wrong with my coding. Hopefully someone else looking at this will be able to point it out, but I just don't know right now. If I'm bored later on, I'll give it a try on my own forum.

You're a good man Starteck, thanks again for your effort.


All times are GMT. The time now is 01:38 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.01642 seconds
  • Memory Usage 1,729KB
  • 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)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (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