How to Making a Watched items page?

jessy Master Sergeant
Staff member
Moderating
badge id 1 1 Year of Membership badge id 13 100 Messages badge id 2 2 Years of Membership badge id 14 500 Messages
Jun 28, 2020
2,922
1,228
$5,866
View attachment 31536
If you have a few add-ons then the amount of "watched items" spread across various menus can be a bit complicated and confusing. This simple template edit will give you a menu on each watched item page that links them all.

I did this in ten minutes. All the clever Xenforo template people may know better ways of doing this, feel free to chime in.

1. Make a new template called something like watched_items_macros

2. Paste this in:
HTML:
<xf:sidenav>
        <div class="block">
                <div class="block-container">
                    <h3 class="block-header">Watched Items</h3>
                    <div class="block-body">
<xf:macro name="links"
                            arg-pageSelected="{$xf.uri}"
                            arg-baseClass="blockLink"
                            arg-selectedClass="is-selected"
                            arg-user="{$user}" />    </div>
                </div>
            </div>

    </xf:sidenav>
<xf:macro name="links" arg-pageSelected="!" arg-baseClass="!" arg-selectedClass="!" arg-user="!">

<a class="{$baseClass} {{ $pageSelected == '/watched/threads' ? {$selectedClass} : '' }}"
        href="{{ link('watched/threads') }}" rel="nofollow">{{ phrase('watched_threads') }}</a>

<a class="{$baseClass} {{ $pageSelected == '/watched/forums' ? {$selectedClass} : '' }}"
        href="{{ link('watched/forums') }}" rel="nofollow">{{ phrase('watched_forums') }}</a>


<!-- the ones below are for add-ons I have - feel free to edit or delete this to suit which ones you have -->

<a class="{$baseClass} {{ $pageSelected == '/watched/wikipost' ? {$selectedClass} : '' }}"
        href="{{ link('watched/wikipost') }}" rel="nofollow">{{ phrase('wikipost_watched_wikiposts') }}</a>

<a class="{$baseClass} {{ $pageSelected == '/watched/ams-articles' ? {$selectedClass} : '' }}"
        href="{{ link('watched/ams-articles') }}" rel="nofollow">{{ phrase('xa_ams_watched_articles') }}</a>

<a class="{$baseClass} {{ $pageSelected == '/watched/ams-series' ? {$selectedClass} : '' }}"
        href="{{ link('watched/ams-series') }}" rel="nofollow">{{ phrase('xa_ams_watched_series') }}</a>

<a class="{$baseClass} {{ $pageSelected == '/watched/media' ? {$selectedClass} : '' }}"
        href="{{ link('watched/ams-media') }}" rel="nofollow">{{ phrase('xfmg_watched_media') }}</a>

<a class="{$baseClass} {{ $pageSelected == '/watched/media-albums' ? {$selectedClass} : '' }}"
        href="{{ link('watched/media-albums') }}" rel="nofollow">{{ phrase('xfmg_watched_albums') }}</a>


</xf:macro>

3. Add the following at the bottom of every template you want to have the menu in.

HTML:
<xf:include template="watched_menu_macro" />


(If you type 'watched_' in the template filter, you should be able to find them -- ignore the ones that say 'manage' at the end of them)

4. That's it

5. Though you may want to go to the Public Navigation section and switch off all the Watched items in the various menus, and perhaps make a new Watched Content one that links to /watched/threads (perhaps under what's new)
 
Back
Top