The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
MySQL query to find users who don't want email
I'm looking to update the below mysql query to look at the "receive admin email" setting in vbulletin, and only select those that are set to YES.
PHP Code:
I *think* it should be something like this (I added AND userfield." . $vbulletin->options['16'] . ") ) PHP Code:
Does that seem right? |
#2
|
|||
|
|||
I think you want to add
Code:
AND (user.options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ") ETA: you'd also need to add user.options to the list of fields being selected. |
#3
|
|||
|
|||
Thanks kh99. I'm not great with mysql (it's easy to get lost with the " ' ), etc). Does this look right:
PHP Code:
|
#4
|
|||
|
|||
I have trouble sorting out that stuff just by looking at it, but I think you have one extra double quote char before the AND you added.
|
#5
|
|||
|
|||
I ended up getting this code to work. I can't say that I really understand it though
Code:
// Get Members $members = $db->query_read(" SELECT user.email, user.userid, user.username, user.options " . iif((!empty($vbulletin->options['c_news_letter_field'])),",userfield." . $vbulletin->options['c_news_letter_field'] . "") . " FROM " . TABLE_PREFIX . "user AS user " . iif((!empty($vbulletin->options['c_news_letter_field'])),"LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)") . " WHERE user.userid >= " . $vbulletin->GPC['startat'] . " " . iif((!empty($vbulletin->options['c_news_letter_field']))," AND (userfield." . $vbulletin->options[c_news_letter_field] . " = '" . $vbulletin->options[c_news_letter_field_yes] . "' OR userfield." . $vbulletin->options[c_news_letter_field] . " = '')") . " " . iif(!$vbulletin->GPC['user']['adminemail'], " AND (options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ")") . " " . iif((!empty($vbulletin->GPC['usergroups'])), "AND user.usergroupid IN ('" . implode("','",$c_news_letter_filter_usergroups) . "')") . " ORDER BY user.userid ASC LIMIT " . $vbulletin->GPC['perpage'] ); this was the line that did the heavy lifting: Code:
" . iif(!$vbulletin->GPC['user']['adminemail'], " AND (options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ")") . " Do you guys see any problems with this code? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|