XF 2.3 Blocking guests from seeing style-variation?

Dannymh

Well-known member
I am having issues trying to hide the style chooser for guests. The reason i want to do this is because under google analytics I am getting absolutely hammered by guest users hitting the misc/style-variations link.
Screenshot 2026-02-12 at 3.08.50 pm.webp

I tried to set this in a template modification as follows on page_container

find:
Code:
<xf:if is="$xf.visitor.canChangeStyleVariation($xf.style)">
                                                <a href="{{ link('misc/style-variation') }}" rel="nofollow"
                                                    class="js-styleVariationsLink"
                                                    data-xf-init="tooltip" title="{{ phrase('style_variation') }}"
                                                    data-xf-click="menu" data-z-index-ref=".u-bottomFixer" role="button" aria-expanded="false" aria-haspopup="true">

                                                    <xf:fa icon="{{ $xf.style.getVariationIcon($xf.visitor.style_variation) }}" title="{{ phrase('style_variation') }}" />
                                                </a>

                                                <div class="menu" data-menu="menu" aria-hidden="true">
                                                    <div class="menu-content js-styleVariationsMenu">
                                                        <xf:macro name="style_variation_macros::variation_menu"
                                                            arg-style="{$xf.style}"
                                                            arg-live="{{ true }}" />
                                                    </div>
                                                </div>
                                            </xf:if>

replace with
Code:
<xf:if is="$xf.visitor.user_id">
                                            <xf:if is="$xf.visitor.canChangeStyleVariation($xf.style)">
                                                <a href="{{ link('misc/style-variation') }}" rel="nofollow"
                                                    class="js-styleVariationsLink"
                                                    data-xf-init="tooltip" title="{{ phrase('style_variation') }}"
                                                    data-xf-click="menu" data-z-index-ref=".u-bottomFixer" role="button" aria-expanded="false" aria-haspopup="true">

                                                    <xf:fa icon="{{ $xf.style.getVariationIcon($xf.visitor.style_variation) }}" title="{{ phrase('style_variation') }}" />
                                                </a>

                                                <div class="menu" data-menu="menu" aria-hidden="true">
                                                    <div class="menu-content js-styleVariationsMenu">
                                                        <xf:macro name="style_variation_macros::variation_menu"
                                                            arg-style="{$xf.style}"
                                                            arg-live="{{ true }}" />
                                                    </div>
                                                </div>
                                                </xf:if>
                                            </xf:if>

However this is not working and I still have the style variation for guests. as seen below

Screenshot 2026-02-12 at 2.43.59 pm.webp

Is there something I am doing wrong or something else I can do to change this?

Regards
Dan
 
Last edited:
Back
Top Bottom