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 04-24-2010, 07:34 PM
caliman's Avatar
caliman caliman is offline
 
Join Date: Jan 2005
Location: California
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 04-24-2010, 08:02 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by caliman View Post
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.
Both Vb 3 and Vb 4 are the same, and have almost the same user db..

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.
Reply With Quote
  #3  
Old 04-24-2010, 08:16 PM
caliman's Avatar
caliman caliman is offline
 
Join Date: Jan 2005
Location: California
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
I get 1 email. The admin's. I do not get any from custom usergroup 46.
Reply With Quote
  #4  
Old 04-24-2010, 08:25 PM
borbole's Avatar
borbole borbole is offline
 
Join Date: Jan 2010
Posts: 2,559
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
Reply With Quote
  #5  
Old 04-24-2010, 08:46 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[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()
Reply With Quote
  #6  
Old 04-24-2010, 09:01 PM
caliman's Avatar
caliman caliman is offline
 
Join Date: Jan 2005
Location: California
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Deceptor View Post
[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()
That brought up 4 mails including admin. Not the 92 I am looking for. Weird.

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?
Reply With Quote
  #7  
Old 04-25-2010, 11:45 AM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]
Reply With Quote
  #8  
Old 04-25-2010, 03:40 PM
caliman's Avatar
caliman caliman is offline
 
Join Date: Jan 2005
Location: California
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 04-25-2010, 04:51 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 04-26-2010, 12:26 AM
caliman's Avatar
caliman caliman is offline
 
Join Date: Jan 2005
Location: California
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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:37 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.04474 seconds
  • Memory Usage 2,269KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)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_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