vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Plugin to capitalize username on registration (https://vborg.vbsupport.ru/showthread.php?t=279233)

malmazan 02-27-2012 05:00 PM

Plugin to capitalize username on registration
 
Hi all:

I'm after a plugin that capitalizes the username on registration, as I require name and last name.

This is what I have:
Code:

$username = ucwords(strtolower($this->fetch_field('username')));
$username_raw = $username;
vB_Template::preRegister('register',array('username_raw' => $username_raw));

assingned to userdata_presave

but it does not work.

I would be very grateful for some help

kh99 02-27-2012 05:05 PM

What hook location are you using (or where did you put that code)?

malmazan 02-28-2012 07:25 AM

Quote:

Originally Posted by kh99 (Post 2303936)
What hook location are you using (or where did you put that code)?

userdata_presave

I used the first two lines succesfully with v3.6, though it stopped working with v3.7

Sarteck 02-28-2012 08:43 AM

Why not (on the same hook):

PHP Code:

$this->set('username'ucwords(strtolower($this->fetch_field('username')))); 

Not tested, but that line should (every time the userdata_presave is called) set the Capitalized Username to the datamanager, should it not?

malmazan 02-29-2012 10:26 AM

Quote:

Originally Posted by Sarteck (Post 2304152)
Why not (on the same hook):

PHP Code:

$this->set('username'ucwords(strtolower($this->fetch_field('username')))); 

Not tested, but that line should (every time the userdata_presave is called) set the Capitalized Username to the datamanager, should it not?

Thanks for the help, though it does not seem to have any effect (does not give an error either).

malmazan 03-02-2012 08:01 AM

Quote:

Originally Posted by malmazan (Post 2304591)
Thanks for the help, though it does not seem to have any effect (does not give an error either).

Actually, I was wrong, it DOES work. Somehow the resulting user name shown on the screen was not capitalized, but the one that ended up on the database was.

That'll save me from having to edit a php file on every update. Thanks a bunch, Sarteck


All times are GMT. The time now is 05:03 PM.

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.01095 seconds
  • Memory Usage 1,725KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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