How to Making a Watched items page?

Joined
Jun 28, 2020
Messages
3,269
Reaction score
1,309
Credits
$6,879
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="b-container">
                    <h3 class="b-header">Watched Items</h3>
                    <div class="b-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)