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

XF 1.5 Watched Threads Item Count

Discussion in 'Styling and Customization Questions' started by Pierce, Jun 20, 2016.

  1. Pierce

    Pierce Well-Known Member


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

    Pierce Well-Known Member

                    if($hookName == 'navigation_tabs_forums')
                            $mm_user = $template->getParam('visitor');
                                    $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);
                                    $contents = str_replace('asdf', '', $contents);

    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.


Share This Page