• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Top Threads - Sidebar

yilmaz

Active member
Unzip the package.

Send to folder library with ftp

You import the admin panel "addon_yilmaz_top_thread.xml"
Just "forum_list".
Search Template;

HTML:
</xen:sidebar>

Above this add:
HTML:
<xen:include template="yilmaz_top_threads" />

Please click LIKE:)
 

Attachments

  • yilmaz_top_threads.zip
    yilmaz_top_threads.zip
    3.4 KB · Views: 168
  • TopThread-caps-1.webp
    TopThread-caps-1.webp
    21.4 KB · Views: 244
  • TopThread-caps-2.webp
    TopThread-caps-2.webp
    13 KB · Views: 762
  • TopThread-caps-3.webp
    TopThread-caps-3.webp
    11.7 KB · Views: 298
Just a dumb question (which I hear are the easiest to answer!).

Doing a Search Template for "</xen:sidebar>" brings up six hits. Do I need to alter all six areas in the template? Or just "forum_list"?
 
Surprisingly, re-reviewed, double does not show me, I could not find a reason not to double show.
 
Hm, nice Add-on Idea BUT

1. You don't checkt the userpermissions
PHP:
                $TTArray = $db->fetchAll( $db->limit( "SELECT * FROM xf_thread as thread WHERE NOT ISNULL(thread.thread_id) $excludedforums AND  thread.discussion_state = 'visible' ORDER BY reply_count DESC", $numShown ));

2. Why does your class extend XenForo_Model_User ??
Do you need any method from this Class?
I can't see anything! IMHO it would make more sense, to extend it from XenForo_Model_Thread because this class contains all thread fetch methods,

3. You have
PHP:
$options = XenForo_Application::get('options');
but you don't use it anywhere because you use allways XenForo_Application::get('options')->yilmaz_tt_show; ;)


This shouldn#t be critic, this are only some little tips from an code reviewer;)
 
How to make it count by post views:

Open library\Yilmaz\TopThread\Model\TTopThread.php

Replace:
PHP:
$TTArray = $db->fetchAll( $db->limit( "SELECT * FROM xf_thread as thread WHERE NOT ISNULL(thread.thread_id) $excludedforums AND  thread.discussion_state = 'visible' ORDER BY reply_count DESC", $numShown ));
with
PHP:
$TTArray = $db->fetchAll( $db->limit( "SELECT * FROM xf_thread as thread WHERE NOT ISNULL(thread.thread_id) $excludedforums AND  thread.discussion_state = 'visible' ORDER BY view_count DESC", $numShown ));
and find
PHP:
$Yilmaz_TopThread[] = array("user" => $userObjs[$TT['user_id']], "userid" => $TT['user_id'], "threadstarter" => $TT['username'], "title" => $TT['title'], "time" => $TT['post_date'], "replycount" => $TT['reply_count'], "lastpostusername" => $TT['last_post_username'], "lastpostdate" => $TT['last_post_date'], "lastpostuserid" => $TT['last_post_user_id'], "href" => $hrefx);
and replace it with
PHP:
$Yilmaz_TopThread[] = array("user" => $userObjs[$TT['user_id']], "userid" => $TT['user_id'], "threadstarter" => $TT['username'], "title" => $TT['title'], "time" => $TT['post_date'], "viewcount" => $TT['view_count'], "lastpostusername" => $TT['last_post_username'], "lastpostdate" => $TT['last_post_date'], "lastpostuserid" => $TT['last_post_user_id'], "href" => $hrefx);
Then install an addon and find a template called yilmaz_top_threads.
Change there
PHP:
{xen:phrase messages}: <b>{$TThread.replycount}</b>
to
PHP:
{xen:phrase views}: <b>{$TThread.viewcount}</b>
 
yes very cool but i need to add this to the footer template instead of the sidebar to match my design please any idea how can i do this ?????
 
hello i see that the recent_status addons 3.0 is a rendred version so we can display it anywhere we want here is a portion code from the templateHooks.php i tried to manipulate it to match your mod but no way to make it work so please can you be kind and update your mods to a rendred version

PHP:
class RecentStatus_Listener_TemplateHook
{
    public static function template_hook($name, &$contents, array $params, XenForo_Template_Abstract $template)
    {
        // Choose the hook you want to manipulate
        if ($name === 'forum_list_sidebar')
        {
            // Change the value of $contents in any way you want
            $xfRecentStatus = RecentStatus_Model_StatusList::getStatusArray();
            $params = array('xfRecentStatus' => $xfRecentStatus['status'],
                            'xfRecentStatusComments' => $xfRecentStatus['comments'],
                            'visitor' => XenForo_Visitor::getInstance(),
                            );

            $contents .= $template->create('recent_status',$params)->render();
        }
    }
}
 
Top Bottom