View Full Version : Execute SQL Query- What is the code to select multiple usergroups/users? [SOLVED]
akz645
09-18-2015, 05:19 PM
http://www.vbulletin.com/forum/forum/vbulletin-3-8/vbulletin-3-8-questions-problems-and-troubleshooting/vbulletin-quick-tips-and-customizations/202694-updating-options-en-masse
Show Reputation
On: UPDATE user SET options=options + 1024 WHERE NOT(options & 1024) AND usergroupid = X;
Off: UPDATE user SET options=options - 1024 WHERE options & 1024 AND usergroupid = X;
What is the coding so I can select multiple UsergroupIDs/UserIDs?
https://vborg.vbsupport.ru/external/2015/09/13.png
https://vborg.vbsupport.ru/external/2015/09/14.png
AND usergroupid IN(1,2,3,4,etc)
Is that what you mean?
akz645
09-18-2015, 09:51 PM
AND usergroupid IN(1,2,3,4,etc)
Is that what you mean?
Yes that was precisely what I was looking for.
Thank you :)
------------------------------------------------------------------------------------------------------------------------------------------------------
A quick summary/guide for anybody reading:
What I'm about to show you below, allows you to change 'Display Reputation (http://i.imgur.com/09QilXE.png)' forcefully for any usergroup(s) or user(s) using Execute SQL Query (http://i.imgur.com/GI6ovEg.png).
If they have been given permission to Hide Reputation from Others (http://i.imgur.com/AmgylSy.png), then they can change Hide/Show reputation from the UserCP later. This just hides/shows reputation from the postbit.
Show Reputation for a single usergroup:
On: UPDATE user SET options=options + 1024 WHERE NOT(options & 1024) AND usergroupid = X;
Off: UPDATE user SET options=options - 1024 WHERE options & 1024 AND usergroupid = X;
Show Reputation for multiple usergroups:
On: UPDATE user SET options=options + 1024 WHERE NOT(options & 1024) AND usergroupid IN(X,X,X);
Off: UPDATE user SET options=options - 1024 WHERE options & 1024 AND usergroupid IN(X,X,X);
Edit: Even if you don't insert multiple usergroupid/userid, it still works with a single one.
Where X = UsergroupID (can be seen from usergroup manger (http://i.imgur.com/HJcfw17.png)).
If you just want it for multiple users instead of multiple usergroups, then change:
usergroupidto:userid
To find userid number, just click on somebody's profile and view the web address. You'll see a ?X-USERNAME
X= userid number.
------------------------------------------------------------------------------------------------------------------------------------------------------
Note:
This is an issue within vbulletin postbit_legacy coding:
If a usergroup doesn't have permission to show/hide reputation from their UserCP, even if you set it as no (manually (http://i.imgur.com/09QilXE.png)), their reputation will still display (green bars).
If you want to fix this, look at my guide here:
Step A (https://vborg.vbsupport.ru/showpost.php?p=2552625&postcount=2) (adds one more condition) which makes it disappear completely (if Display Reputation (http://i.imgur.com/09QilXE.png) is set to No by the admin) even if they don't have permission to edit from the UserCP.
You don't have to check out the rest of the thread. You only need to do Step A.
Note 2:
http://www.vbulletin.com/forum/forum/vbulletin-3-8/vbulletin-3-8-questions-problems-and-troubleshooting/vbulletin-quick-tips-and-customizations/202694-updating-options-en-masse
If you want to change other UserCP settings, look at that thread.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.