Latest Threads Monthly Email [Deleted]

Is there an issue with this addon with XF 1.2.1? I'm suddenly getting this error when the cron tries to run:
PHP:
Parse error: syntax error, unexpected T_FUNCTION in /home/adminx/public_html/library/XenForo/Mail.php on line 362

Update! It was the XF 1.2.1 "Mail bug" (an issue with PHP 5.2) - fixed with this patch: http://xenforo.com/community/threads/xenforo-1-2-1-released.58022/#post-618539 and now working. :)
 
Last edited:
To manually specify forum IDs to pull from:

Open library/MonthlyEmails/Model/Email.php

Delete the code in red:

Rich (BB 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:

Rich (BB code):
            $nodeIds = array(
                '2',
                '3',
                '4'
            );


The resulting code will look like:
Rich (BB 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;
    }

Does this code still work to restrict it to certain forums?
 
I've installed BD Mail and use Mandrill. Is it safe to send out? I'm sure that with the first run, I'll get a few spam reports and plenty of bounces.

Thoughts? What's the best solution?

Also, does this add-on pull threads that are admin-only? I installed XFLetter and it showed moderator threads.
 
This does not seem to check for Valid member. It sends it to "awaiting email confirmation (from edit) which is not "Valid".
 
Well done, @Code Monkey you may have uncovered a bug.

PHP:
        $users = $this->getModelFromCache('XenForo_Model_User')->getUsers(array(
            'user_status' => 'valid',
            'receive_admin_email' => 1,
            'is_banned' => 0,
        ), array(
            'join' => XenForo_Model_User::FETCH_USER_FULL
        ));

Should be:

PHP:
        $users = $this->getModelFromCache('XenForo_Model_User')->getUsers(array(
            'user_state' => 'valid',
            'receive_admin_email' => 1,
            'is_banned' => 0,
        ), array(
            'join' => XenForo_Model_User::FETCH_USER_FULL
        ));
 
This won't email out threads from private sections will it? How do you configure what date it will send out the email? Looking forward to testing this out!
 
Anyone get into trouble with spam complaints or blacklisting as a result of this? Is there an unsubscribe link?

Also, is there a way to send the mail only to active users, those who have been around in the past month or two? I saw someone else earlier ask about this, but I did not see a response.

Thanks!
 
Anyone get into trouble with spam complaints or blacklisting as a result of this? Is there an unsubscribe link?

Also, is there a way to send the mail only to active users, those who have been around in the past month or two? I saw someone else earlier ask about this, but I did not see a response.

Thanks!

I have made a change to the template so that at the end it offers the user a way to unsubscribe. Will update this shortly.
 
Awesome. However I'm pretty sure there are specifics that are required by email host that need to be included in the text.
 
Awesome. However I'm pretty sure there are specifics that are required by email host that need to be included in the text.

Generally you're supposed to have an unsubscribe link and a physical address (p.o. box being okay) in newsletters.

This is from Mailchimp, which is parrotting the can-spam guidelines:

You must include your contact information inside every promotional email that you send, including a physical mailing address where you can receive mail or a PO Box. (Not a website or email address.)
 
Top Bottom