• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Latest Threads Monthly Email [Deleted]

Brent W

Well-known member
#1
BamaStangGuy submitted a new resource:

Latest Threads Monthly Email (version 1.0.0) - Sends an email once a month highlighting your most recent threads

This add-on was born from this add-on: http://xenforo.com/community/resources/monthly-whats-new-email.912/

I was not happy with that version because it pulled based on new posts and not on new threads.

This version pulls the latest threads based on creation date. You have an option in Options > Monthly "Whats New" Email to set how many topics it will pull.

This also makes sure that banned users are not included in the email, which the original version did not take into...
Read more about this resource...
 

Chris D

XenForo developer
Staff member
#6
How to make this 4 times a year?
You can't.

It's done via a cron entry so it can be set to: Monthly, Weekly, Daily or Hourly.

And can you pick a specific forum to prune from?
Prune? Do you mean fetch threads from a specific forum? Currently the add-on fetches threads only from forums that are public. There's no interface to specify a specific forum, but I could probably suggest a code edit...
 

Chris D

XenForo developer
Staff member
#8
To manually specify forum IDs to pull from:

Open library/MonthlyEmails/Model/Email.php

Delete the code in red:

Code:
	protected function _getRecentPublicThreads()
	{
		$nodeModel = $this->getModelFromCache('XenForo_Model_Node');
		$nodes = $nodeModel->getAllNodes(false, true);
		$nodePermissions = $nodeModel->getNodePermissionsForPermissionCombination(1);
        
		$nodeHandlers = $nodeModel->getNodeHandlersForNodeTypes(
			$nodeModel->getUniqueNodeTypeIdsFromNodeList($nodes)
		);
		
		$nodes = $nodeModel->getViewableNodesFromNodeList($nodes, $nodeHandlers, $nodePermissions);
        
		$options = XenForo_Application::get('options');
        
		foreach ($nodes as $node)
		{
			$nodeIds[] = $node['node_id'];
		}
        
		$conditions = array(
			'node_id' => $nodeIds);
        	
		$fetchOptions = array(
			'order' => 'post_date',
			'limit' => $options->monthlyEmailsThreadLimit);
        
		$threadModel = $this->getModelFromCache('XenForo_Model_Thread');
        
		$threads = $threadModel->getThreads($conditions, $fetchOptions);
        
		return $threads;
	}
In its place, add:

Code:
			$nodeIds = array(
				'2',
				'3',
				'4'
			);

The resulting code will look like:
Code:
	protected function _getRecentPublicThreads()
	{
		$nodeIds = array(
			'2',
			'3',
			'4'
		);
        
		$conditions = array(
			'node_id' => $nodeIds);
        	
		$fetchOptions = array(
			'order' => 'post_date',
			'limit' => $options->monthlyEmailsThreadLimit);
        
		$threadModel = $this->getModelFromCache('XenForo_Model_Thread');
        
		$threads = $threadModel->getThreads($conditions, $fetchOptions);
        
		return $threads;
	}
 

Chris D

XenForo developer
Staff member
#9
Correction to the above:

DO NOT delete the line:

$options = XenForo_Application::get('options');

It is highlighted in red, but just delete the red lines before or after it.
 

Mouth

Well-known member
#10
I installed, but don't appear to have the cron in /admin.php?cron/
Definantly installed the files and XML without error.
What did I miss?
 

Chris D

XenForo developer
Staff member
#11
You must have missed something as the cron is definitely in the XML file:

Code:
  <cron>
    <entry entry_id="sendMonthlyEmails" cron_class="MonthlyEmails_CronEntry_MonthlyEmail" cron_method="sendEmails" active="1"><![CDATA[{"day_type":"dom","dom":["1"],"hours":["0"],"minutes":["0"]}]]></entry>
  </cron>
EDIT: Yes, you must have missed something. It's definitely there:
 

kkm323

Well-known member
#12
Lovely this mod will increase the traffic for sure.
Thank you, I will try this as soon as I get home. I will gladly donate if you send me your payable account ;)
Chris Deeming also deserve a donation as will. thank you so much for most of the work and codes you have put into this community.
 

Mouth

Well-known member
#15
Currently the add-on fetches threads only from forums that are public.
The add-on that this was "born from" says it only pulls from forums the emailed user is allowed to see. Does it still do that, or definantly only public one's? ie. will a user with access to a non-public forum get topics in their email that are included in that forum, or is that forum's topic excluded?
 

Chris D

XenForo developer
Staff member
#16
@Rich - I would be interested in the tweaks you made too.
The add-on that this was "born from" says it only pulls from forums the emailed user is allowed to see. Does it still do that, or definantly only public one's? ie. will a user with access to a non-public forum get topics in their email that are included in that forum, or is that forum's topic excluded?
Who's Rich? And what tweaks?

The add-on this was born from has only ever pulled threads from public forums.
 

System0

Active member
#20
This seems like a great add on Bama. Is there a way for members to opt out of the monthly email?

Years ago I used the vbulletin monthly newsletter app and it brought it a lot of traffic. Many members didn't like it though so they opted out so that they didn't get emailed. Looking at the options, there doesn't seem to be an option for members to stop getting the monthly email....though perhaps I'm looking in the wrong place.