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:
// Get Members
$members = $db->query_read("
SELECT user.email, user.userid, user.username " . 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((!empty($vbulletin->GPC['usergroups'])), "AND user.usergroupid IN ('" . implode("','",$c_news_letter_filter_usergroups) . "')") . "
ORDER BY user.userid ASC
LIMIT " . $vbulletin->GPC['perpage']
);
I *think* it should be something like this (I added AND userfield." . $vbulletin->options['16'] . ") )
PHP Code:
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] . " = '') AND userfield." . $vbulletin->options['16'] . ") ") . "
" . iif((!empty($vbulletin->GPC['usergroups'])), "AND user.usergroupid IN ('" . implode("','",$c_news_letter_filter_usergroups) . "')") . "
ORDER BY user.userid ASC
Does that seem right?