vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Spacing (https://vborg.vbsupport.ru/showthread.php?t=255450)

Lilmikeishere 12-18-2010 12:37 AM

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.

calorie 12-18-2010 12:44 AM

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, ' ')));


Lilmikeishere 12-18-2010 12:45 AM

Which file would that be done in?

calorie 12-18-2010 12:47 AM

File class_dm_user.php and maybe elsewhere, you'd need to check to be sure.

Lilmikeishere 12-18-2010 12:49 AM

Anyone know what I would specifically have to do?

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

bump

kh99 12-18-2010 01:50 AM

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.

Lilmikeishere 12-18-2010 04:53 PM

Im assuming some knowledge of regex patterns would be useful here?

kh99 12-18-2010 05:22 PM

Quote:

Originally Posted by Lilmikeishere (Post 2135970)
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).

Lilmikeishere 12-18-2010 08:14 PM

Quote:

Originally Posted by kh99 (Post 2135991)
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.

kh99 12-18-2010 08:42 PM

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).


All times are GMT. The time now is 03:04 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.01191 seconds
  • Memory Usage 1,736KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete