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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2005, 12:32 AM
eMike eMike is offline
 
Join Date: Nov 2002
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [SQL] Sorting users into one group

On my forum, a gamingforum, I have loads of members who registers username syntaxes like "Clan_Nickname" or "Guild_Nickname".

I am in need of sorting this out, for example (and more specifically) getting all users with the "Clan-A_" prefix into usergroup "Clan A" or with the "Guild-B_" prefix nto usergroup "Guild B"

How would I go about doing that? (Except doing it manually)

I do not know much about databases, but im hoping that with the use of some magic SQL command in the SQL Query section of the vB ACP, that this can be done.

Any help would be sooo very appreciated!
Reply With Quote
  #2  
Old 10-01-2005, 05:11 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Select them would not be a real problem. Changing usergroups might be, although i can think of some tricks.

Are you talking about primairy or seconday usergroups?
Is this a 1 time action or ongoing?
Reply With Quote
  #3  
Old 10-01-2005, 12:57 PM
eMike eMike is offline
 
Join Date: Nov 2002
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All are primary I believe, and it would be a 1-time action only.
Reply With Quote
  #4  
Old 10-01-2005, 01:10 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The most secure way if you are not using reputation that is, would be the following:

[sql]UPDATE user set reputation = 99999999 WHERE username LIKE 'Clan-A_%'[/sql]
Then create a Usergroup Promotion that will promote the user to the correct usergroup if they have > 99999998 reputation. Wait until the promotion has run.

Then reset (rebuild or reset with SQL) reputation, and go repeat the process for the next group.

Make sure that if you have 'Clan_Member' and 'Clan_A_Member' you process the longest identifier first, and exclude the longer group when you go processing 'Clan_%'.

I have not tested this, so first try on a testboard. Also make sure you have good backups.
Reply With Quote
  #5  
Old 10-02-2005, 12:11 AM
eMike eMike is offline
 
Join Date: Nov 2002
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
The most secure way if you are not using reputation that is, would be the following:

[sql]UPDATE user set reputation = 99999999 WHERE username LIKE 'Clan-A_%'[/sql]
Then create a Usergroup Promotion that will promote the user to the correct usergroup if they have > 99999998 reputation. Wait until the promotion has run.

Then reset (rebuild or reset with SQL) reputation, and go repeat the process for the next group.

Make sure that if you have 'Clan_Member' and 'Clan_A_Member' you process the longest identifier first, and exclude the longer group when you go processing 'Clan_%'.

I have not tested this, so first try on a testboard. Also make sure you have good backups.
It worked like a dream Marco!
My deepest and sincerest thanks! That saved me for endless upon endless hours of manual nightmares.

Reply With Quote
  #6  
Old 10-02-2005, 06:13 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good tho hear that my not very standard solution worked.
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 07:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03845 seconds
  • Memory Usage 2,208KB
  • 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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete