The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
sql needed to get email of user in custom usergroup
I am trying to get emails for users in a custom usergroup.
This appears to be a different field than normal usergroups. Does anyone know the sql for this? I thought about using the stock email app in vb but i am paranoid about sending to primary usergroups - i just want to send to this specific group and it is unclear how to do that). Thanks! caliman edit - sorry posted on wrong board - i am on 3.8.4. |
#2
|
||||
|
||||
Quote:
VB 4 Attachment 116269 Vb 3 Attachment 116270 So no change for costum groups, as you can see groupid #9 is costum.. and users are stored same position always. |
#3
|
||||
|
||||
hmmm..
custom usergroup is 46 (there are 92 members in there according to usergroup manager usergroup 2 is admin when I do : Code:
SELECT email FROM user WHERE usergroupid IN (46,6); |
#4
|
||||
|
||||
Do you want a sql query to retrieve all the email addresses of the users in your custom group id 46? If so run this query:
Code:
SELECT email FROM user WHERE usergroupid = 46; |
#5
|
||||
|
||||
[sql]select email from user where usergroupid in (46, 6)
or find_in_set(membergroupids, 6) or find_in_set(membergroupids, 46)[/sql] If the usergroup is secondary, you'll need the additional clauses to scan membergroupids which is saved in a comma deliminated format, easily readable thanks to MySQLs find_in_set() |
#6
|
||||
|
||||
Quote:
When I look in usergroup manager - the users for this custom group are noted under 'additional users' there are none in primary users. Does this help? |
#7
|
||||
|
||||
Ah whoops, I got my SQL a little backward:
[sql]select email from user where usergroupid in (46, 6) or find_in_set(6, membergroupids) or find_in_set(46, membergroupids)[/sql] |
#8
|
||||
|
||||
THAT WORKED. Thanks Deceptor. I appreciate your help a lot here. I'd give you karma if that mod was installed.
A question about the stock email sender in the user section of the admincp... If I selected 'admin' as primary usergroup and 'supporter' (my custom usergroup) in the 2nd usergroup box - would it send to all the people in my custom usergroup or is it going to look for every that is an admin AND a supporter? |
#9
|
||||
|
||||
It would send to either/or, so primary UG admin and anyone with the secondary "supporter". If unsure you can always use the "test email" feature which will show a list of users it -would- send an email to, but not actually do it
|
#10
|
||||
|
||||
Oddly 'admin' did not work, it looks like it is an 'AND' clause. I used basically 'registered users' AND 'supporters' and came up with the right number.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|