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

Add-on $30 For Modification

Discussion in 'Custom Service/Development Requests' started by Brent W, Oct 29, 2012.

  1. Brent W

    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.
     
  2. HWS

    HWS Well-Known Member

    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.
     
  3. Brent W

    Brent W Well-Known Member

    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];
        }
     
    }
    
     
    Brandon Sheley likes this.
  4. Brent W

    Brent W Well-Known Member

  5. xfrocks

    xfrocks Well-Known Member

    Have you contacted Slavik? Modifying is not very straight forward because the thread_id is not available from the last_post info of the forum. Of course it can be done but it's best to ask the author to do that for you, paid work or else.
     
  6. Brent W

    Brent W Well-Known Member

    Yes, no response.
     
  7. Brent W

    Brent W Well-Known Member

    If $30 is not sufficient to get this done please let me know your quote.
     
  8. Chris D

    Chris D XenForo Developer Staff Member

    $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.
     
    Mouth likes this.

Share This Page