XF 2.0 Display condition - public navigation

AndyB

Well-known member
What is the correct code to use a Permission definition in the Display condition of a public navigation?

The following code results in the tab not showing, even though I have permission set to Yes.

1512931376193.webp
 
As if it was in a PHP inequality.
Code:
$xf.visitor->hasPermission('EWRrio', 'submitChannels')
 
You’re basically already using the correct condition so I can only assume that there’s a typo in your group ID or permission ID or you don’t have the permission as you expect.
 
Interesting thread, thanks @AndyB

I am trying to also implement a permission set on the public nav but mostly to prevent guests from accessing some gallery features.
I have tried this but it prevented it for all, most likely the group id and the way I've called it.

Is anyone able to kindly help with what's needed to get this working correctly please?
Code:
$xf.visitor.isMemberOf == 1

Saying that, this is probably the wrong code anyway.
 
Code:
$xf.visitor.user_id

Guests have a user_id of 0, this condition is short hand for "User ID is greater than 0" so it would exclude guests.

FWIW if you're checking for a user group it would be:

Code:
$xf.visitor.isMemberOf(1)
 
Code:
$xf.visitor.user_id

Guests have a user_id of 0, this condition is short hand for "User ID is greater than 0" so it would exclude guests.

FWIW if you're checking for a user group it would be:

Code:
$xf.visitor.isMemberOf(1)
Thank you! Yes just found it when running another search too and it worked perfectly.

Many thanks.
 
Top Bottom