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

[XenMods] Announcements [Deleted]

Discussion in 'Add-on Releases' started by Daniel Hood, Jul 10, 2013.

  1. Daniel Hood

    Daniel Hood Well-Known Member

    Daniel Hood submitted a new resource:

    PHP Help Center Announcements - Make global sticky threads

    Read more about this resource...
     
  2. Travis

    Travis Active Member

    Error on install
    Screen Shot 2013-07-11 at 10.23.22 AM.png
     
  3. Daniel Hood

    Daniel Hood Well-Known Member

    That's a weird error? Try uninstalling and deleting and then trying again. Did you refresh in the middle of the installation or did it error before that so you tried again or something?
     
  4. Daniel Hood

    Daniel Hood Well-Known Member

    I just realized an event listener that was supposed to be disabled was left on and made it into the xml file. Uploading a revision in a minute. Thanks for pointing it out.
     
  5. Daniel Hood

    Daniel Hood Well-Known Member

  6. kankan

    kankan Active Member

    Hi does it works on 1.1.3 version of Xenforo ?
    Using RichUsername, got this message when using the addon in Admin :

    Code:
    Argument 2 passed to RichUsernameEverywhere_Thread::prepareThread() must be an array, boolean given, called in /home/e-smith/files/ibays/forumasus/html/www/library/PHCannouncements/Model/Threads.php on line 42 and defined
    
        XenForo_Application::handlePhpError() in RichUsernameEverywhere/Thread.php at line 41
        RichUsernameEverywhere_Thread->prepareThread() in PHCannouncements/Model/Threads.php at line 42
        PHCannouncements_Model_Threads->Stickies() in PHCannouncements/ControllerAdmin/Index.php at line 12
        PHCannouncements_ControllerAdmin_Index->actionIndex() in XenForo/FrontController.php at line 310
        XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
        XenForo_FrontController->run() in /home/e-smith/files/ibays/forumasus/html/www/admin.php at line 13
    
     
  7. Daniel Hood

    Daniel Hood Well-Known Member

    I don't have version 1.1.3 downloaded so I can't see; could you post this section of code (should be one of the first few lines of code) from /upload/library/XenForo/Model/Forum.php

    PHP:
    public function getForumById($id, array $fetchOptions = array())
    {
    /*
    All this code
    */
    }
     
  8. kankan

    kankan Active Member

    PHP:
    public function getForumById($id, array $fetchOptions = array())
        {
            
    $joinOptions $this->prepareForumJoinOptions($fetchOptions);

            return 
    $this->_getDb()->fetchRow('
                SELECT node.*, forum.*
                    ' 
    $joinOptions['selectFields'] . '
                FROM xf_forum AS forum
                INNER JOIN xf_node AS node ON (node.node_id = forum.node_id)
                ' 
    $joinOptions['joinTables'] . '
                WHERE node.node_id = ?
            '
    $id);
        }
     
  9. Daniel Hood

    Daniel Hood Well-Known Member

    Can you try disabling RichUsernameEverywhere for a second and see if it works? Also, is it possible you have a sticky thread in a node that you deleted?
     
  10. kankan

    kankan Active Member

    Code:
    Argument 2 passed to Dark_PostRating_Model_Thread::prepareThread() must be an array, boolean given, called in /home/e-smith/files/ibays/forumasus/html/www/library/PHCannouncements/Model/Threads.php on line 42 and defined
    
        XenForo_Application::handlePhpError() in Dark/PostRating/Model/Thread.php at line 35
        Dark_PostRating_Model_Thread->prepareThread() in PHCannouncements/Model/Threads.php at line 42
        PHCannouncements_Model_Threads->Stickies() in PHCannouncements/ControllerAdmin/Index.php at line 12
        PHCannouncements_ControllerAdmin_Index->actionIndex() in XenForo/FrontController.php at line 310
        XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
        XenForo_FrontController->run() in /home/e-smith/files/ibays/forumasus/html/www/admin.php at line 13
    
     
  11. kankan

    kankan Active Member

    Now it is postRating :)
     
  12. Daniel Hood

    Daniel Hood Well-Known Member

    Awesome, lol. Is it possible you have a sticky thread in a node that no longer exists?
     
  13. kankan

    kankan Active Member

    Don't know really if i have, i shall browse all my forum ;)
    (an addon would be welcome for that purpose lol)
     
  14. Daniel Hood

    Daniel Hood Well-Known Member

    I can type a query if you want to run it in phpmyadmin?
     
  15. kankan

    kankan Active Member

  16. Daniel Hood

    Daniel Hood Well-Known Member

    Code:
    SELECT thread.thread_id, node.title as nodeTitle FROM `xf_thread` thread LEFT JOIN xf_node node on node.node_id = thread.node_id WHERE thread.sticky = 1
    
    if nodeTitle says NULL for any rows, that's the issue.
     
  17. kankan

    kankan Active Member

    Thank you. No NULL present.
     
  18. Daniel Hood

    Daniel Hood Well-Known Member

    Change in file /upload/library/PHCannouncements/Model/Threads.php

    Code:
        function Stickies()
        {      
            $ThreadModel = XenForo_Model::create('XenForo_Model_Thread');
            $ForumModel = XenForo_Model::create('XenForo_Model_Forum');
         
            $_getThreads = $this->_getDb()->fetchAll("SELECT thread.thread_id as thread_id, thread.node_id
                FROM xf_thread as thread
                WHERE thread.sticky = 1
                ORDER BY thread.last_post_date DESC"
            );
         
            $Threads = array();
         
            for ($i = 0; $i < count($_getThreads); $i++)
            {
                $Thread = $ThreadModel->prepareThread($ThreadModel->getThreadById($_getThreads[$i]['thread_id'], array('join' => 17)), $ForumModel->getForumById($_getThreads[$i]['node_id']));
                $Thread['canInlineMod'] = false;
                $Thread['canEditThread'] = false;
                $Threads[] = $Thread;
            }
         
         
            return $Threads;
        }
    
    to

    Code:
        function Stickies()
        {      
            $ThreadModel = XenForo_Model::create('XenForo_Model_Thread');
            $ForumModel = XenForo_Model::create('XenForo_Model_Forum');
         
            $_getThreads = $this->_getDb()->fetchAll("SELECT thread.thread_id as thread_id, thread.node_id
                FROM xf_thread as thread
                WHERE thread.sticky = 1
                ORDER BY thread.last_post_date DESC"
            );
         
            $Threads = array();
         
            for ($i = 0; $i < count($_getThreads); $i++)
            {
                var_dump(array('id' => $_getThreads[$i]['node_id'], 'result' => $ForumModel->getForumById($_getThreads[$i]['node_id'])));
                $Thread = $ThreadModel->prepareThread($ThreadModel->getThreadById($_getThreads[$i]['thread_id'], array('join' => 17)), $ForumModel->getForumById($_getThreads[$i]['node_id']));
                $Thread['canInlineMod'] = false;
                $Thread['canEditThread'] = false;
                $Threads[] = $Thread;
            }
         
         
            return $Threads;
        }
    
    and let me know what the page shows
     
  19. kankan

    kankan Active Member

    Daniel, i do not have the same code in my file. (see my Forum.php attached)
     

    Attached Files:

  20. Daniel Hood

    Daniel Hood Well-Known Member

    This file: /upload/library/PHCannouncements/Model/Threads.php

    It belongs to the addon
     

Share This Page