diff --git a/activethreads.php b/activethreads.php index 52ec1b0..06dd04a 100644 --- a/activethreads.php +++ b/activethreads.php @@ -30,8 +30,9 @@ function getLatestActiveThreads($forum_id = 0, $limit = 7, $exclude_invisible = // Run the Query $query = $pdo->select() ->from(MYBB_PREFIX.'threads') + ->leftJoin(MYBB_PREFIX.'forums', MYBB_PREFIX.'forums.fid', '=', MYBB_PREFIX.'threads.fid') ->whereMany($condition, '=') - ->orderBy('lastpost', 'DESC') + ->orderBy(MYBB_PREFIX.'threads.lastpost', 'DESC') ->limit(intval($limit), 0) ->execute(); diff --git a/digest.html b/digest.html deleted file mode 100644 index f71fcce..0000000 --- a/digest.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - -

{{Username}},

- -

Here’s a daily update of activity on the Olympic Business forum.

- -

- - - - - - - - - - - - - - - - -
ForumThreadStarted byPost countLast update
- Sales - - Sales thread [hyperlink]
- How do I increase sales? -
User.Name, 20/04/20173User.Name, 24/04/2017

- -

Thank you,
- Olympic Business Forum Staff

- -

To unsubscribe from these daily digests, click here: {{link}}

- - diff --git a/digest.php b/digest.php index d2d6e6b..9698851 100644 --- a/digest.php +++ b/digest.php @@ -1,6 +1,7 @@ select() + ->from(MYBB_PREFIX.'users') + ->where('usergroup', '=', 4) + ->where('isSubscribed', '=', 1) + ->execute() + ->fetchAll(); +foreach ($users as $user) { + $email = $user['email']; + print_email($user['username'], '/unsubscribe', $threads); +} diff --git a/email.php b/email.php new file mode 100644 index 0000000..41b89c4 --- /dev/null +++ b/email.php @@ -0,0 +1,47 @@ + + + + + + Daily digest from Olympic Business Forum + + +

,

+ +

Here’s a daily update of activity on the Olympic Business forum.

+ +

+ + + + + + + + + + + + + + + + + + +
ForumThreadStarted byPost countLast update
+ , + + + , + +

+ +

Thank you,
+ Olympic Business Forum Staff

+ +

To unsubscribe from these daily digests, click here:

+ + +