1. 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]

Discussion in 'Add-on Releases' started by BamaStangGuy, Nov 6, 2012.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    BamaStangGuy submitted a new resource:

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

    Read more about this resource...
     
    Brandon Sheley likes this.
  2. BamaStangGuy

    BamaStangGuy Well-Known Member

  3. Allan

    Allan Well-Known Member

    Do you have a screen to mail please ?
     
  4. DRE

    DRE Well-Known Member

    How to make this 4 times a year?
     
  5. Mark3121

    Mark3121 Well-Known Member

    And can you pick a specific forum to prune from?
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    You can't.

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

    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...
     
  7. DRE

    DRE Well-Known Member

    If you disable it every three months and hit run cron u can lol.

    Didn't want to resort to that but i will.

    Thanks for making this.
     
    Brandon Sheley and Chris D like this.
  8. Chris D

    Chris D XenForo Developer Staff Member

    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;
    	}
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  10. Mouth

    Mouth Well-Known Member

    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?
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    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:
    [​IMG]
     
  12. kkm323

    kkm323 Well-Known Member

    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.
     
  13. kkm323

    kkm323 Well-Known Member

    installed! I am now waiting for the emails :)
     
  14. Mouth

    Mouth Well-Known Member

    @Rich - I would be interested in the tweaks you made too.
     
  15. Mouth

    Mouth Well-Known Member

    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?
     
  16. Chris D

    Chris D XenForo Developer Staff Member

    Who's Rich? And what tweaks?

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

    Mouth Well-Known Member

  18. Chris D

    Chris D XenForo Developer Staff Member

  19. Mouth

    Mouth Well-Known Member

    OK, thanks for clarification. Appreciate it.
     
  20. System0

    System0 Active Member

    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.
     

Share This Page