XF 1.5 Watched Threads Item Count

Pierce

Well-known member
Hi,

Like Alerts at the top right, with the red box and a number, which is great for bringing new content and actions to users attention, but I think the "Watched Threads" needs more love.

Is there an easy way, to do an item counter on "Watched Threads" to show how many threads you are subscribed to which are unread thus making the user more likely to click on Watched Threads?

Item count looks like this: https://xenforo.com/community/threads/itemcount-support-for-custom-tabs.29296/

But the rest of the logic I don't know where to start to grab a count of unread watched threads.

Thanks in advance.
 
Code:
                if($hookName == 'navigation_tabs_forums')
                {


                        $mm_user = $template->getParam('visitor');

                        if($mm_user['user_id']!=0)
                        {
                                $mm_model_thread = new XenForo_Model_ThreadWatch();
                                $mm_thread_count = count($mm_model_thread->getThreadsWatchedByUser($mm_user['user_id'], true));
                        }


                        if($mm_thread_count > 0)
                        {
                                $mm_thread_count_text = '<strong class="itemCount"><span class="Total">'. $mm_thread_count .'</span><sp$
                                $contents = str_replace('asdf', $mm_thread_count_text,$contents);
                        }
                        else
                        {     
                                $contents = str_replace('asdf', '', $contents);
                        }
                }

upload_2016-6-21_19-30-38.webp

It wasn't the hardest thing in the world to do.

Is there any easier way of injecting text into the template instead of my quick and nasty edit the template to have "asdf" and replace that instead.

Pierce
 
Back
Top Bottom