vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   How to reserve usernames? (https://vborg.vbsupport.ru/showthread.php?t=159096)

001 09-30-2007 01:57 AM

How to reserve usernames?
 
I would like to reserve more than 100 usernames before I start a forum. I know I can blacklist them but it will disallow any other combination with these names however I don't want to do this. Can I use quotes or something to reserve only the required names? Mod anyone?

nexialys 09-30-2007 02:31 AM

my suggestion would be to create these users now, and give the password to the persons you want these usernames to be given... this is the simpliest way of doing it.

001 09-30-2007 04:01 AM

The problem is everyone can see these user names by checking the profiles of the first registered users. Also it is not really easy and convenient to create all these users that might be even more, not to mention the incorrect number of users that will be displayed on the home page. The idea is if I can use the blacklist option that should be modified to check for exact matches.

Adrian Schneider 09-30-2007 05:49 AM

The best way I can think of is editing your ./includes/class_dm_user.php file and adding something along the lines of
PHP Code:

$reserved = array(
    
'SirAdrian',
    
'001',
    
'nexialys'
    
// ...
);

if (
in_array($username$reserved))
{
    
$this->error('usernametaken'$username$this->registry->session->vars['sessionurl']);
    return 
false;


At the end of the verify_username function, just above where it says
PHP Code:

        // if we got here, everything is okay
        
$username htmlspecialchars_uni($username);
        return 
true

Or the simple way (covers less angles but doesn't require file edits), add a plugin using the register_addmember_process hook, with:
PHP Code:

$reserved = array(
    
'SirAdrian',
    
'001',
    
'nexialys'
    
// ...
);

if (
in_array($vbulletin->GPC['username'], $reserved))
{
    
$userdata->error('usernametaken'$vbulletin->GPC['username'], $vbulletin->session->vars['sessionurl']);


If someone wanted they could take it a step further and use an option instead of hardcoding the names.

001 10-01-2007 07:44 PM

Thank you. I tried the plugin although I don't know what you mean by "cover less angles".
But it seems it doesn't convert to lower case.

Adrian Schneider 10-01-2007 08:31 PM

Adding new users by other means than registration.

Whether it's your own registration form, adding via AdminCP, etc. It goes through the datamanager than just the registration form.

001 10-01-2007 08:59 PM

I see. And any solutions about the lowercase conversion? Otherwise the registration can still be made even if the name is reserved.

Adrian Schneider 10-01-2007 09:11 PM

change it to..

PHP Code:

if (in_array(strtolower($var), $list)) 

You'll have to read between the lines a bit to do it. The array of names would also need to be in lowercase.

001 10-01-2007 09:25 PM

Thanks a lot. It seems it only works with English characters though. However the the usual registration recognizes properly if the user name is really taken with non-English letters. It there a way to make this work too?

Adrian Schneider 10-02-2007 12:48 AM

I think vb has its own strtolower function that better handles non-English chars. I'll check later tonight.


All times are GMT. The time now is 01:16 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.02237 seconds
  • Memory Usage 1,749KB
  • 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_php_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