XF 2.2 Hide conversations and alerts to unconfirmed users

El Porcharo

Well-known member
Licensed customer
Some time ago I've added a template modification for PAGE_CONTAINER to hide conversations and alert to new users that are still unconfirmed.

I then upgrade to the latest XF 2.2.12 a couple of days ago, and today I've noticed that my XF seems to completely ignore the FIND/REPLACE code (only in the front-end), besides the TEST button shows my modfications.

Here's the FIND code:

Code:
                            <a href="{{ link('conversations') }}"
                                class="p-navgroup-link p-navgroup-link--iconic p-navgroup-link--conversations js-badge--conversations badgeContainer{{ $xf.visitor.conversations_unread ? ' badgeContainer--highlighted' : '' }}"
                                data-badge="{$xf.visitor.conversations_unread|number}"
                                data-xf-click="menu"
                                data-xf-key="{{ phrase('shortcut.conversations_menu')|for_attr }}"
                                data-menu-pos-ref="< .p-navgroup"
                                title="{{ phrase('conversations')|for_attr }}"
                                aria-label="{{ phrase('conversations')|for_attr }}"
                                aria-expanded="false"
                                aria-haspopup="true">
                                <i aria-hidden="true"></i>
                                <span class="p-navgroup-linkText">{{ phrase('nav_inbox') }}</span>
                            </a>
                            <div class="menu menu--structural menu--medium" data-menu="menu" aria-hidden="true"
                                data-href="{{ link('conversations/popup') }}"
                                data-nocache="true"
                                data-load-target=".js-convMenuBody">
                                <div class="menu-content">
                                    <h3 class="menu-header">{{ phrase('conversations') }}</h3>
                                    <div class="js-convMenuBody">
                                        <div class="menu-row">{{ phrase('loading...') }}</div>
                                    </div>
                                    <div class="menu-footer menu-footer--split">
                                        <div class="menu-footer-main">
                                            <ul class="listInline listInline--bullet">
                                                <li><a href="{{ link('conversations') }}">{{ phrase('show_all') }}</a></li>
                                                <xf:if is="$xf.visitor.canStartConversation()">
                                                    <li><a href="{{ link('conversations/add') }}">{{ phrase('start_new_conversation') }}</a></li>
                                                </xf:if>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <a href="{{ link('account/alerts') }}"
                                class="p-navgroup-link p-navgroup-link--iconic p-navgroup-link--alerts js-badge--alerts badgeContainer{{ $xf.visitor.alerts_unviewed ? ' badgeContainer--highlighted' : '' }}"
                                data-badge="{$xf.visitor.alerts_unviewed|number}"
                                data-xf-click="menu"
                                data-xf-key="{{ phrase('shortcut.alerts_menu')|for_attr }}"
                                data-menu-pos-ref="< .p-navgroup"
                                title="{{ phrase('alerts')|for_attr }}"
                                aria-label="{{ phrase('alerts')|for_attr }}"
                                aria-expanded="false"
                                aria-haspopup="true">
                                <i aria-hidden="true"></i>
                                <span class="p-navgroup-linkText">{{ phrase('nav_alerts') }}</span>
                            </a>
                            <div class="menu menu--structural menu--medium" data-menu="menu" aria-hidden="true"
                                data-href="{{ link('account/alerts-popup') }}"
                                data-nocache="true"
                                data-load-target=".js-alertsMenuBody">
                                <div class="menu-content">
                                    <h3 class="menu-header">{{ phrase('alerts') }}</h3>
                                    <div class="js-alertsMenuBody">
                                        <div class="menu-row">{{ phrase('loading...') }}</div>
                                    </div>
                                    <div class="menu-footer menu-footer--split">
                                        <div class="menu-footer-main">
                                            <ul class="listInline listInline--bullet">
                                                <li><a href="{{ link('account/alerts') }}">{{ phrase('show_all') }}</a></li>
                                                <li><a href="{{ link('account/alerts/mark-read') }}" class="js-alertsMarkRead">{{ phrase('mark_read') }}</a></li>
                                                <li><a href="{{ link('account/preferences') }}">{{ phrase('preferences') }}</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>

and here's the REPLACE code:

Code:
                    <xf:if is="{{!$xf.visitor.isMemberOf(1)}}"> <!-- IF NOT MEMBER OF UNREGISTERED/UNCONFIRMED -->
                            <a href="{{ link('conversations') }}"
                                class="p-navgroup-link p-navgroup-link--iconic p-navgroup-link--conversations js-badge--conversations badgeContainer{{ $xf.visitor.conversations_unread ? ' badgeContainer--highlighted' : '' }}"
                                data-badge="{$xf.visitor.conversations_unread|number}"
                                data-xf-click="menu"
                                data-xf-key="{{ phrase('shortcut.conversations_menu')|for_attr }}"
                                data-menu-pos-ref="< .p-navgroup"
                                title="{{ phrase('conversations')|for_attr }}"
                                aria-label="{{ phrase('conversations')|for_attr }}"
                                aria-expanded="false"
                                aria-haspopup="true">
                                <i aria-hidden="true"></i>
                                <span class="p-navgroup-linkText">{{ phrase('nav_inbox') }}</span>
                            </a>
                            <div class="menu menu--structural menu--medium" data-menu="menu" aria-hidden="true"
                                data-href="{{ link('conversations/popup') }}"
                                data-nocache="true"
                                data-load-target=".js-convMenuBody">
                                <div class="menu-content">
                                    <h3 class="menu-header">{{ phrase('conversations') }}</h3>
                                    <div class="js-convMenuBody">
                                        <div class="menu-row">{{ phrase('loading...') }}</div>
                                    </div>
                                    <div class="menu-footer menu-footer--split">
                                        <div class="menu-footer-main">
                                            <ul class="listInline listInline--bullet">
                                                <li><a href="{{ link('conversations') }}">{{ phrase('show_all') }}</a></li>
                                                <xf:if is="$xf.visitor.canStartConversation()">
                                                    <li><a href="{{ link('conversations/add') }}">{{ phrase('start_new_conversation') }}</a></li>
                                                </xf:if>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <a href="{{ link('account/alerts') }}"
                                class="p-navgroup-link p-navgroup-link--iconic p-navgroup-link--alerts js-badge--alerts badgeContainer{{ $xf.visitor.alerts_unviewed ? ' badgeContainer--highlighted' : '' }}"
                                data-badge="{$xf.visitor.alerts_unviewed|number}"
                                data-xf-click="menu"
                                data-xf-key="{{ phrase('shortcut.alerts_menu')|for_attr }}"
                                data-menu-pos-ref="< .p-navgroup"
                                title="{{ phrase('alerts')|for_attr }}"
                                aria-label="{{ phrase('alerts')|for_attr }}"
                                aria-expanded="false"
                                aria-haspopup="true">
                                <i aria-hidden="true"></i>
                                <span class="p-navgroup-linkText">{{ phrase('nav_alerts') }}</span>
                            </a>
                            <div class="menu menu--structural menu--medium" data-menu="menu" aria-hidden="true"
                                data-href="{{ link('account/alerts-popup') }}"
                                data-nocache="true"
                                data-load-target=".js-alertsMenuBody">
                                <div class="menu-content">
                                    <h3 class="menu-header">{{ phrase('alerts') }}</h3>
                                    <div class="js-alertsMenuBody">
                                        <div class="menu-row">{{ phrase('loading...') }}</div>
                                    </div>
                                    <div class="menu-footer menu-footer--split">
                                        <div class="menu-footer-main">
                                            <ul class="listInline listInline--bullet">
                                                <li><a href="{{ link('account/alerts') }}">{{ phrase('show_all') }}</a></li>
                                                <li><a href="{{ link('account/alerts/mark-read') }}" class="js-alertsMarkRead">{{ phrase('mark_read') }}</a></li>
                                                <li><a href="{{ link('account/preferences') }}">{{ phrase('preferences') }}</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                    </xf:if><!-- IF NOT MEMBER OF UNREGISTERED/UNCONFIRMED -->
I've also noticed that I have a couple of other templates modification that is being ignored since when I upgraded XF.

Does anyone know how can I fix this non-working feature?


Cheers
 
Did you check if PAGE_CONTAINER and others concerned templates are not outdated and need to be merged?
 
Yep!

There are no outdated templates at all. Those few that was left over after the update was automatically merged and the page is now empty.

IMG_20221223_004943.webp
 
I'm not sure but I use conditional statements like that <xf:if is="!$xf.visitor.isMemberOf(1)"> or <xf:if is="{!$xf.visitor.isMemberOf(1)}"> but never with {{ }}. But if it worked like this before, it should still work...
 
I just tested with your code directly in the template it works well.
So maybe the "bug" comes from your FIND/REPLACE template modification.
 
Back
Top Bottom