XF 2.2 $xf.visitor.style_id == X does not show for guests

Solution
Better to use $xf.style.style_id, which will give you the ID of the current style. Using $xf.visitor.style_id only gives you the preference, which for the vast majority of users (and all guests) will be 0 (which means to use the default style).

Edit: I think it works now. I had to add "$xf.visitor.style_id == 69 OR !$xf.visitor.style_id == 69" for the Dark navigation.
This probably doesn't work the way you expect (or if it does, it's merely incidental). If you wanted to check if the ID was not 69, you'd use $xf.style.style_id != 69.
I have two navigation links. This is one of them for "Light mode":
light.png

So I want this navigation tab to show for both guests and members if they are on the dark style (style ID: 70) and visa versa.

Edit: I think it works now. I had to add "$xf.visitor.style_id == 69 OR !$xf.visitor.style_id == 69" for the Dark navigation.
 
Last edited:
Better to use $xf.style.style_id, which will give you the ID of the current style. Using $xf.visitor.style_id only gives you the preference, which for the vast majority of users (and all guests) will be 0 (which means to use the default style).

Edit: I think it works now. I had to add "$xf.visitor.style_id == 69 OR !$xf.visitor.style_id == 69" for the Dark navigation.
This probably doesn't work the way you expect (or if it does, it's merely incidental). If you wanted to check if the ID was not 69, you'd use $xf.style.style_id != 69.
 
Solution
Back
Top Bottom