Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-30-2007, 01:57 AM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 09-30-2007, 02:31 AM
nexialys
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #3  
Old 09-30-2007, 04:01 AM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 09-30-2007, 05:49 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 10-01-2007, 07:44 PM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 10-01-2007, 08:31 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 10-01-2007, 08:59 PM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see. And any solutions about the lowercase conversion? Otherwise the registration can still be made even if the name is reserved.
Reply With Quote
  #8  
Old 10-01-2007, 09:11 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 10-01-2007, 09:25 PM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #10  
Old 10-02-2007, 12:48 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think vb has its own strtolower function that better handles non-English chars. I'll check later tonight.
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 04:41 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.04650 seconds
  • Memory Usage 2,262KB
  • Queries Executed 13 (?)
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_php
  • (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
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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