Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
de02a7fc
Commit
de02a7fc
authored
Aug 16, 2018
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid sending emails to blocked and unapproved users
parent
40f15d44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
mailing.php
qa-include/app/mailing.php
+10
-3
users.php
qa-include/db/users.php
+1
-1
No files found.
qa-include/app/mailing.php
View file @
de02a7fc
...
...
@@ -59,6 +59,7 @@ function qa_mailing_stop()
function
qa_mailing_perform_step
()
{
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
$lastuserid
=
qa_opt
(
'mailing_last_userid'
);
...
...
@@ -89,11 +90,17 @@ function qa_mailing_perform_step()
qa_opt
(
'mailing_last_userid'
,
$lastuserid
);
qa_opt
(
'mailing_done_users'
,
qa_opt
(
'mailing_done_users'
)
+
count
(
$users
));
$isModeratingUsers
=
qa_opt
(
'moderate_users'
);
foreach
(
$users
as
$user
)
{
if
(
!
(
$user
[
'flags'
]
&
QA_USER_FLAGS_NO_MAILINGS
))
{
qa_mailing_send_one
(
$user
[
'userid'
],
$user
[
'handle'
],
$user
[
'email'
],
$user
[
'emailcode'
]);
$sentusers
++
;
if
((
$user
[
'flags'
]
&
QA_USER_FLAGS_NO_MAILINGS
)
||
// exclude users who don't want to get the mailings
(
$user
[
'flags'
]
&
QA_USER_FLAGS_USER_BLOCKED
)
||
// exclude blocked users
(
$isModeratingUsers
&&
(
$user
[
'level'
]
<
QA_USER_LEVEL_APPROVED
)))
{
// if moderating users exclude unapproved users
continue
;
}
qa_mailing_send_one
(
$user
[
'userid'
],
$user
[
'handle'
],
$user
[
'email'
],
$user
[
'emailcode'
]);
$sentusers
++
;
}
qa_opt
(
'mailing_last_timestamp'
,
$lasttime
+
$sentusers
*
60
/
$perminute
);
// can be floating point result, based on number of mails actually sent
...
...
qa-include/db/users.php
View file @
de02a7fc
...
...
@@ -376,7 +376,7 @@ function qa_db_user_levels_set($userid, $userlevels)
function
qa_db_users_get_mailing_next
(
$lastuserid
,
$count
)
{
return
qa_db_read_all_assoc
(
qa_db_query_sub
(
'SELECT userid, email, handle, emailcode, flags FROM ^users WHERE userid># ORDER BY userid LIMIT #'
,
'SELECT userid, email, handle, emailcode, flags
, level
FROM ^users WHERE userid># ORDER BY userid LIMIT #'
,
$lastuserid
,
$count
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment