MyBB Community Forums

Full Version: weekly mass notification
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This might already be available somewhere but if not, i would like it.

Does anyone know how or if possible to do a weekly mass email to all members of the newest threads that have been started over the past week? i need to automatically send out a notification email to all my members a notice of any threads that were started in the past 7 days.

Anyone know how to do this or if there is a plugin that can do it? I searched and didnt really find anything.

TIA
I looked through the search.php file and found the code for the action=getdaily. Could this be duplicated and then alterd to do something like action=getweekly?
I dont really know enough about php to tweak this i dont think.
If this could be done then I think I could just go in and manually do a mass mailing if I had to.


elseif($mybb->input['action'] == "getdaily")
{
	if($mybb->input['days'] < 1)
	{
		$days = 1;
	}
	else
	{
		$days = intval($mybb->input['days']);
	}
	$datecut = TIME_NOW-(86400*$days);

	$where_sql = "t.lastpost >='".$datecut."'";

	if($mybb->input['fid'])
	{
		$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
	}
	else if($mybb->input['fids'])
	{
		$fids = explode(',', $mybb->input['fids']);
		foreach($fids as $key => $fid)
		{
			$fids[$key] = intval($fid);
		}
		
		if(!empty($fids))
		{
			$where_sql .= " AND t.fid IN (".implode(',', $fids).")";
		}
	}
	
	$unsearchforums = get_unsearchable_forums();
	if($unsearchforums)
	{
		$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
	}
	$inactiveforums = get_inactive_forums();
	if($inactiveforums)
	{
		$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
	}


	$sid = md5(uniqid(microtime(), 1));
	$searcharray = array(
		"sid" => $db->escape_string($sid),
		"uid" => $mybb->user['uid'],
		"dateline" => TIME_NOW,
		"ipaddress" => $db->escape_string($session->ipaddress),
		"threads" => '',
		"posts" => '',
		"resulttype" => "threads",
		"querycache" => $db->escape_string($where_sql),
		"keywords" => ''
	);

	$plugins->run_hooks("search_do_search_process");
	$db->insert_query("searchlog", $searcharray);
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}

I have sort of answered my own question partially...
In the code above i changed
if($mybb->input['days'] < 1)
{
$days = 1

TO

if($mybb->input['days'] < 7)
{
$days = 7

now to just get "View Last Weeks Posts" to show up in the header section...then I can just manually go in run that and email out the link

anyone got a better idea?
OK I got the correct code to show up in my header...heres what i used:
I put it in the header_welcomeblock_member template

<span style="float:right;">{$lang->welcome_current_time}</span>
{$lang->welcome_back} (<a href="{$mybb->settings['bburl']}/usercp.php"><strong>{$lang->welcome_usercp}</strong></a>{$modcplink}{$admincplink} &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}">{$lang->welcome_logout}</a>)<br />
<span class="links">
<a href="#" onclick="MyBB.popupWindow('{$mybb->settings['bburl']}/misc.php?action=buddypopup', 'buddyList', 350, 350);">{$lang->welcome_open_buddy_list}</a>
</span>
<a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->welcome_newposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->welcome_todaysposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getweekly">Last 7 Days</a> | <a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}
dont you just love when you post something and then you respond to yourself with the answer Big Grin