Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-18-2010, 12:37 AM
Lilmikeishere Lilmikeishere is offline
 
Join Date: Dec 2008
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Spacing

How would you make it so a username can have more than 1 space in their username?

At the moment you can only have one space in your name.
Reply With Quote
  #2  
Old 12-18-2010, 12:44 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would need to do a file edit:
Code:
	/**
	* Verifies that the provided username is valid, and attempts to correct it if it is not valid
	*
	* @param	string	Username
	*
	* @return	boolean	Returns true if the username is valid, or has been corrected to be valid
	*/
	function verify_username(&$username)
	{
		// fix extra whitespace and invisible ascii stuff
		$username = trim(preg_replace('#[ \r\n\t]+#si', ' ', strip_blank_ascii($username, ' ')));
Reply With Quote
  #3  
Old 12-18-2010, 12:45 AM
Lilmikeishere Lilmikeishere is offline
 
Join Date: Dec 2008
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which file would that be done in?
Reply With Quote
  #4  
Old 12-18-2010, 12:47 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

File class_dm_user.php and maybe elsewhere, you'd need to check to be sure.
Reply With Quote
  #5  
Old 12-18-2010, 12:49 AM
Lilmikeishere Lilmikeishere is offline
 
Join Date: Dec 2008
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know what I would specifically have to do?

--------------- Added [DATE]1292642489[/DATE] at [TIME]1292642489[/TIME] ---------------

bump
Reply With Quote
  #6  
Old 12-18-2010, 01:50 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try taking the space out of the pattern that condenses white space, like this:

Code:
// fix extra whitespace and invisible ascii stuff
$username = trim(preg_replace('#[\r\n\t]+#si', ' ', strip_blank_ascii($username, ' ')));

(the red is where I took out the space)

But I haven't tried it, and I don't know if that's all you would have to do.
Reply With Quote
  #7  
Old 12-18-2010, 04:53 PM
Lilmikeishere Lilmikeishere is offline
 
Join Date: Dec 2008
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im assuming some knowledge of regex patterns would be useful here?
Reply With Quote
  #8  
Old 12-18-2010, 05:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lilmikeishere View Post
Im assuming some knowledge of regex patterns would be useful here?
Well, yeah, if you want to understand that code. I'm not an expert in that field, but this:

Code:
preg_replace('#[ \r\n\t]+#si', ' ', ...
says replace all sequences of one or more "white space" characters (space, carriage return, newline, tab) with a single space. So obviously any name entered with more than one space in a row will be changed to one space. I was suggesting taking the space out of that pattern (the one right before \r).
Reply With Quote
  #9  
Old 12-18-2010, 08:14 PM
Lilmikeishere Lilmikeishere is offline
 
Join Date: Dec 2008
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
Well, yeah, if you want to understand that code. I'm not an expert in that field, but this:

Code:
preg_replace('#[ \r\n\t]+#si', ' ', ...
says replace all sequences of one or more "white space" characters (space, carriage return, newline, tab) with a single space. So obviously any name entered with more than one space in a row will be changed to one space. I was suggesting taking the space out of that pattern (the one right before \r).
Didn't seem to work.

Actually, when you edit it in the admin cp, the name has 2 spaces, but it only shows one space publicly on the current users, or users visited in 24 hours, so I'm guessing something else would have to be modified as well.
Reply With Quote
  #10  
Old 12-18-2010, 08:42 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wonder if that's just HTML - normally multiple spaces get condensed to one. I'm not sure how to fix that easily. You could find everywhere a user name is being displayed and change spaces to  , but that seems like a lot of places.

There's a function called fetch_musername() in includes/functions that gets the "marked up" user name, so if you changed that it would probably handle most places, but I know there are some places where it's just the bare user name.

In retrospect, the single-space thing is probably a good thing because having people with the same user name other than spacing could get confusing (but I'm sure you have your reasons for wanting to allow it).
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 01:52 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.04967 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete