vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [SQL] Sorting users into one group (https://vborg.vbsupport.ru/showthread.php?t=97263)

eMike 10-01-2005 12:32 AM

[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! :)

Marco van Herwaarden 10-01-2005 05:11 AM

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?

eMike 10-01-2005 12:57 PM

All are primary I believe, and it would be a 1-time action only.

Marco van Herwaarden 10-01-2005 01:10 PM

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.

eMike 10-02-2005 12:11 AM

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.

:)

Marco van Herwaarden 10-02-2005 06:13 AM

Good tho hear that my not very standard solution worked. :D


All times are GMT. The time now is 09:19 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.01078 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete