Thanks Yaldaram.
That's just what i was looking for, but did you read the reviews?
Quote:This plugin is sooo bad. The author didn't even take the time to change the text "Turn akismet on or off". If a user doesn't come online when he received his message, the plugin will send the message over and over again every day. Also the message can't even consist of Html Code. There is a nice idea behind this but the plugin is just bad!
That's scary.. can not use this without a fix.
Does anyone see in the plugin code where this can be changed?
inc\tasks - dailymissyouemail.php
<?php
function task_dailymissyouemail($task)
{
global $db, $mybb;
$cutoff = TIME_NOW-60*60*24*intval($mybb->settings['mye_days']);
$users = $db->simple_select("users", "username, email, myesent", "lastactive <= '".$cutoff."'");
if($db->num_rows($users) > 0)
{
$mass_email['subject'] = strip_tags($mybb->settings['mye_subject']);
$mass_email['subject'] = str_replace("{username}", $user['username'], $mass_email['subject']);
$mass_email['subject'] = str_replace("{bbname}", $mybb->settings['bbname'], $mass_email['subject']);
$mass_email['subject'] = str_replace("{bburl}", $mybb->settings['bburl'], $mass_email['subject']);
$mass_email['subject'] = str_replace("{days}", intval($mybb->settings['mye_days']);, $mass_email['subject']);
while($user = $db->fetch_array($users))
{
if($user['myesent'] == 0)
{
$mass_email['message'] = str_replace("{username}", $user['username'], $mybb->settings['mye_message']);
$mass_email['message'] = str_replace("{bbname}", $mybb->settings['bbname'], $mass_email['message']);
$mass_email['message'] = str_replace("{bburl}", $mybb->settings['bburl'], $mass_email['message']);
$mass_email['message'] = str_replace("{days}", intval($mybb->settings['mye_days']);, $mass_email['message']);
my_mail($user['email'], $mass_email['subject'], $mass_email['message']);
add_task_log($task, "User ".$user['username']." was emailed.");
}
}
}
add_task_log($task, "Miss You Email task ran successfully.");
}
?>
inc\plugins - missyouemail.php
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("global_end", "missyouemail_global_end");
function missyouemail_info() {
return array(
"name" => "Miss You Email",
"description" => "Sends an email to each use that hasn't posted in X days.",
"website" => "http://mods.mybboard.net/view/we-miss-you-plugin",
"author" => "LegosJedi",
"authorsite" => "http://mods.mybboard.net/profile/6391",
"version" => "1.0.0",
"guid" => "582448d8377dd6d0c475612cdf3fb774",
"compatibility" => "14*",
);
}
function missyouemail_install() {
global $db;
$query = $db->simple_select("settinggroups", "COUNT(*) as rows");
$rows = $db->fetch_field($query, "rows");
$insertarray = array(
'name' => 'missyouemail',
'title' => 'Miss You Email',
'disporder' => $rows+1,
'isdefault' => 0
);
$group['gid'] = $db->insert_query("settinggroups", $insertarray);
$insertarray = array(
'name' => 'mye_onoff',
'title' => 'Miss You Email Switch',
'description' => 'Turns on or off Akismet.',
'optionscode' => 'onoff',
'value' => 1,
'disporder' => 0,
'gid' => $group['gid']
);
$db->insert_query("settings", $insertarray);
$insertarray = array(
'name' => 'mye_days',
'title' => 'Day Limit',
'description' => 'How many days should a user be inactive before the email is sent?',
'optionscode' => 'text',
'value' => '30',
'disporder' => 0,
'gid' => $group['gid']
);
$db->insert_query("settings", $insertarray);
$insertarray = array(
'name' => 'mye_subject',
'title' => 'Email Subject',
'description' => 'The Subject of the email to be sent out.',
'optionscode' => 'text',
'value' => 'Forum Inactivity - {bbname}',
'disporder' => 0,
'gid' => $group['gid']
);
$db->insert_query("settings", $insertarray);
$insertarray = array(
'name' => 'mye_message',
'title' => 'Email Message',
'description' => 'The message that will be sent to the user. You can type {username} for the username, {bbname} for your board name, {bburl} for the url of your board, and {days} for the day limit entered above.',
'optionscode' => 'textarea',
'value' => $db->escape_string("Hi, {username}\n\nYou've been gone for a while. According to our records, you haven't visited {bbname} in the last {days} days. Why not stop by and start a new discussion, or contribute to an existing one? Come let people know you're still alive!\n\n{bbname}\n{bburl}\n\n--------\n\nThis is an automated message. Please do not reply to this message."),
'disporder' => 0,
'gid' => $group['gid']
);
$db->insert_query("settings", $insertarray);
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD myesent int NOT NULL default 0");
rebuild_settings();
}
function missyouemail_is_installed()
{
global $db;
if($db->field_exists('myesent', "users"))
{
return true;
}
return false;
}
function missyouemail_activate()
{
global $db;
$insertarray = array(
'title' => 'Miss You Email',
'description' => 'Sends out emails to users who have been inactive for X amount of days',
'file' => 'dailymissyouemail',
'minute' => 0,
'hour' => 0,
'day' => '*',
'month' => '*',
'weekday' => '*',
'nextrun' => TIME_NOW, // Let's run it now, shall we?
'lastrun' => 0,
'enabled' => 1,
'logging' => 1,
'locked' => 0
);
$db->insert_query("tasks", $insertarray);
}
function missyouemail_uninstall()
{
global $db;
if($db->field_exists('myesent', "users"))
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP myesent");
}
// DELETE ALL SETTINGS TO AVOID DUPLICATES
$db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN(
'mye_onoff',
'mye_days',
'mye_subject',
'mye_message'
)");
$db->delete_query("settinggroups", "name = 'missyouemail'");
}
function missyouemail_deactivate()
{
global $db;
$db->delete_query("tasks", "title = 'Miss You Email'");
}
function missyouemail_global_end()
{
global $mybb, $db;
if($mybb->user['myesent'] == 1)
{
$db->update_query("user", "myesent=0", "uid='".intval($mybb->user['uid'])."'");
}
}
?>
What a shame, i hope this can be tweaked?
Anyone help?