Actual HTML digests
This commit is contained in:
parent
6986eb6847
commit
46b95b0780
|
@ -30,8 +30,9 @@ function getLatestActiveThreads($forum_id = 0, $limit = 7, $exclude_invisible =
|
||||||
// Run the Query
|
// Run the Query
|
||||||
$query = $pdo->select()
|
$query = $pdo->select()
|
||||||
->from(MYBB_PREFIX.'threads')
|
->from(MYBB_PREFIX.'threads')
|
||||||
|
->leftJoin(MYBB_PREFIX.'forums', MYBB_PREFIX.'forums.fid', '=', MYBB_PREFIX.'threads.fid')
|
||||||
->whereMany($condition, '=')
|
->whereMany($condition, '=')
|
||||||
->orderBy('lastpost', 'DESC')
|
->orderBy(MYBB_PREFIX.'threads.lastpost', 'DESC')
|
||||||
->limit(intval($limit), 0)
|
->limit(intval($limit), 0)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
|
39
digest.html
39
digest.html
|
@ -1,39 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
||||||
<html>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
||||||
<head></head>
|
|
||||||
<body>
|
|
||||||
<p>{{Username}},</p>
|
|
||||||
|
|
||||||
<p>Here’s a daily update of activity on the Olympic Business forum.</p>
|
|
||||||
|
|
||||||
<p><table style="padding: 1em">
|
|
||||||
<thead>
|
|
||||||
<th style="padding: 0.5em">Forum</th>
|
|
||||||
<th>Thread</th>
|
|
||||||
<th>Started by</th>
|
|
||||||
<th>Post count</th>
|
|
||||||
<th>Last update</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td style="padding: 0.5em">
|
|
||||||
Sales
|
|
||||||
</td>
|
|
||||||
<td style="padding: 0.5em">
|
|
||||||
Sales thread [hyperlink]<br>
|
|
||||||
How do I increase sales?
|
|
||||||
</td>
|
|
||||||
<td>User.Name, 20/04/2017</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>User.Name, 24/04/2017</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table></p>
|
|
||||||
|
|
||||||
<p>Thank you,<br>
|
|
||||||
Olympic Business Forum Staff</p>
|
|
||||||
|
|
||||||
<p>To unsubscribe from these daily digests, click here: {{link}}</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
11
digest.php
11
digest.php
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once "vendor/autoload.php";
|
require_once "vendor/autoload.php";
|
||||||
require_once "activethreads.php";
|
require_once "activethreads.php";
|
||||||
|
require_once "email.php";
|
||||||
define("MYBB_ROOT", "../");
|
define("MYBB_ROOT", "../");
|
||||||
define("MYBB_PREFIX", "mybb_");
|
define("MYBB_PREFIX", "mybb_");
|
||||||
define("FORUM_ID", 0);// 0 means all forums
|
define("FORUM_ID", 0);// 0 means all forums
|
||||||
|
@ -10,3 +11,13 @@ $pwd = '123456';
|
||||||
|
|
||||||
$pdo = new \Slim\PDO\Database($dsn, $usr, $pwd);
|
$pdo = new \Slim\PDO\Database($dsn, $usr, $pwd);
|
||||||
$threads = getLatestActiveThreads(FORUM_ID, 100, true);
|
$threads = getLatestActiveThreads(FORUM_ID, 100, true);
|
||||||
|
$users = $pdo->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);
|
||||||
|
}
|
||||||
|
|
47
email.php
Normal file
47
email.php
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
function print_email($username, $unsubscription, $threads) { ?>
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<head>
|
||||||
|
<title>Daily digest from Olympic Business Forum</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p><?php echo $username ?>,</p>
|
||||||
|
|
||||||
|
<p>Here’s a daily update of activity on the Olympic Business forum.</p>
|
||||||
|
|
||||||
|
<p><table style="padding: 1em">
|
||||||
|
<thead>
|
||||||
|
<th style="padding: 0.5em">Forum</th>
|
||||||
|
<th style="padding: 0.5em">Thread</th>
|
||||||
|
<th style="padding: 0.5em">Started by</th>
|
||||||
|
<th style="padding: 0.5em">Post count</th>
|
||||||
|
<th style="padding: 0.5em">Last update</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($threads as $thread) { ?>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 0.5em"><?php echo $thread['name'] ?></td>
|
||||||
|
<td style="padding: 0.5em"><?php echo $thread['subject'] ?></td>
|
||||||
|
<td style="padding: 0.5em">
|
||||||
|
<?php echo $thread['username'] ?>,
|
||||||
|
<?php echo date('d.m.Y H:m:i', $thread['dateline']) ?>
|
||||||
|
</td>
|
||||||
|
<td style="padding: 0.5em"><?php echo $thread['posts'] ?></td>
|
||||||
|
<td style="padding: 0.5em">
|
||||||
|
<?php echo $thread['lastposter'] ?>,
|
||||||
|
<?php echo date('d.m.Y H:m:i', $thread['lastpost']) ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table></p>
|
||||||
|
|
||||||
|
<p>Thank you,<br>
|
||||||
|
Olympic Business Forum Staff</p>
|
||||||
|
|
||||||
|
<p>To unsubscribe from these daily digests, click here: <a href="<?php echo $unsubscription ?>"><?php echo $unsubscription ?></a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php } ?>
|
Reference in a new issue