Add-on $30 For Modification

Brent W

Well-known member
I simply need this add-on changed so that it lists the most recent threads and not most recent posts. Right now it pulls from last_post_date. I need it to pull be most recent thread created.
 
If it pulls from xf_thread why don't you simply post the code in question so someone will be able to change it 4U?
It seems to be an easy modification with just a few words to be changed. Not worth even $30 perhaps.
 
If it pulls from xf_thread why don't you simply post the code in question so someone will be able to change it 4U?
It seems to be an easy modification with just a few words to be changed. Not worth even $30 perhaps.

Sorry, I forgot to put the link: http://xenforo.com/community/resources/monthly-whats-new-email.912/

Code:

Code:
<?php
 
class MonthlyEmails_Model_Email extends XenForo_Model
{
    public function sendMonthlyEmails()
    {
        $users = $this->getModelFromCache('XenForo_Model_User')->getUsers(array(
            'user_status' => 'valid',
            'receive_admin_email' => 1,
        ), array(
            'join' => XenForo_Model_User::FETCH_USER_FULL
        ));
 
        $viewParams = array(
            'options' => XenForo_Application::get('options'),
            'threads' => $this->_getRecentPublicThreads()
        );
 
        foreach ($users as $user)
        {
            $mail = XenForo_Mail::create('monthly_email', array_merge($viewParams, array('user' => $user)), $user['language_id']);
            $mail->enableAllLanguagePreCache();
            $mail->queue($user['email'], $user['username']);
        }
    }
 
    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);
        $nodes = $nodeModel->mergeExtraNodeDataIntoNodeList($nodes, $nodeHandlers);
        $nodes = $nodeModel->prepareNodesWithHandlers($nodes, $nodeHandlers);
 
        $postIds = array();
        foreach ($nodes as $node)
        {
            if (!empty($node['last_post_id']))
                $postIds[$node['last_post_id']] = $node['last_post_date'];
        }
        arsort($postIds);
        $postIds = array_slice(array_keys($postIds), 0, 3);
        $threads = $this->getModelFromCache('XenForo_Model_Post')->getPostsAndParentData($postIds);
 
        return $threads[1];
    }
 
}
 
$30 should be sufficient.

I have started work on this - nearly complete.

xfrocks - you're absolutely right. That is exactly the correct and most respectful attitude towards the original developer. He has, however, confirmed he isn't inclined to develop the original add-on further.
 
Top Bottom