whocarez wrote: ↑Sun Feb 19, 2017 10:09 am
Another small issue is, that bots are also added to the digest, when a new one is added and
Enable automatic subscriptions:
is switched on. It is under normal circumstances no problem, but I used a script which added about 200 common bots and some of them had email addresses

. So I got a lot of bounced emails for the standard weekly digest for which new users are automatically subscribed.
UPDATE `phpbb_users` SET `user_digest_type` = 'NONE' WHERE `group_id` =6 AND `user_digest_type` LIKE 'WEEK'
solved the problem, but maybe the extension should exclude bots from subscribing to the digest

.
In addition, it occurred to me that the SQL I used to fetch users to receive digests for a given hour could be improved to only permit normal users and founders to be in the query. So lines 410-455 of
ext/phpbbservices/digests/cron/task/digests.php
, currently:
Code: Select all
// Get users requesting digests for the current hour. Also, grab the user's style, so the digest will have a familiar look.
if ($this->config['override_user_style'])
{
$sql_array = array(
'SELECT' => 'u.*, s.*',
'FROM' => array(
USERS_TABLE => 'u',
STYLES_TABLE => 's',
),
'WHERE' => 's.style_id = ' . $this->config['default_style'] . '
AND (' .
$daily_digest_sql . $weekly_digest_sql . $monthly_digest_sql .
")
AND (user_digest_send_hour_gmt = $current_hour_gmt OR user_digest_send_hour_gmt = $current_hour_gmt_plus_30)
AND user_inactive_reason = 0
AND user_digest_type <> '" . constants::DIGESTS_NONE_VALUE . "'",
'ORDER_BY' => ' user_lang',
);
}
else
{
$sql_array = array(
'SELECT' => 'u.*, s.*',
'FROM' => array(
USERS_TABLE => 'u',
STYLES_TABLE => 's',
),
'WHERE' => 'u.user_style = s.style_id
AND (' .
$daily_digest_sql . $weekly_digest_sql . $monthly_digest_sql .
")
AND (user_digest_send_hour_gmt = $current_hour_gmt OR user_digest_send_hour_gmt = $current_hour_gmt_plus_30)
AND user_inactive_reason = 0
AND user_digest_type <> '" . constants::DIGESTS_NONE_VALUE . "'",
'ORDER_BY' => 'user_lang',
);
}
will be this in the next version:
Code: Select all
// Get users requesting digests for the current hour. Also, grab the user's style, so the digest will have a familiar look.
$allowed_user_types = 'AND ' . $this->db->sql_in_set('user_type', array(USER_FOUNDER, USER_NORMAL));
if ($this->config['override_user_style'])
{
$sql_array = array(
'SELECT' => 'u.*, s.*',
'FROM' => array(
USERS_TABLE => 'u',
STYLES_TABLE => 's',
),
'WHERE' => 's.style_id = ' . $this->config['default_style'] . '
AND (' .
$daily_digest_sql . $weekly_digest_sql . $monthly_digest_sql .
")
AND (user_digest_send_hour_gmt = $current_hour_gmt OR user_digest_send_hour_gmt = $current_hour_gmt_plus_30)
AND user_inactive_reason = 0 " . $allowed_user_types . "
AND user_digest_type <> '" . constants::DIGESTS_NONE_VALUE . "'",
'ORDER_BY' => ' user_lang',
);
}
else
{
$sql_array = array(
'SELECT' => 'u.*, s.*',
'FROM' => array(
USERS_TABLE => 'u',
STYLES_TABLE => 's',
),
'WHERE' => 'u.user_style = s.style_id
AND (' .
$daily_digest_sql . $weekly_digest_sql . $monthly_digest_sql .
")
AND (user_digest_send_hour_gmt = $current_hour_gmt OR user_digest_send_hour_gmt = $current_hour_gmt_plus_30)
AND user_inactive_reason = 0 " . $allowed_user_types . "
AND user_digest_type <> '" . constants::DIGESTS_NONE_VALUE . "'",
'ORDER_BY' => 'user_lang',
);
}