Implemented Add Permissions for Widgets

This suggestion has been implemented. Votes are no longer accepted.
I'd like to see the same type of permissions added to Widgets that are in Advertising.

User is a member of any of the selected user groups:
User is NOT a member of any of the selected user groups:


Sometimes the Advertising zones are not suitable so we have to use the HTML Widget to place and ad, for example, in the middle of the What's New feed or in the middle of the Sidebar. And controlling who sees this would be optimal.

Thanks
 
$xf.visitor.user_id = Registered users only
!$xf.visitor.user_id = Unregistered users only

This helps in the meantime! But some of us have trust levels/promoted groups we'd like to include/exclude so I hope this can be considered.
 
Last edited:
Actually, I'm going to call this implemented based on widget display conditions, which is the best approach for this.

You can do user group checks too:

Code:
$xf.visitor.isMemberOf([3, 4, 5])
(Visitor is member of groups 3, 4 or 5)

Code:
!$xf.visitor.isMemberOf([3, 4, 5])
(Visitor is not a member of groups 3, 4, or 5)

Code:
$xf.visitor.isMemberOf(3) AND !$xf.visitor.isMemberOf(4)
(Visitor is a member of group 3, but not group 4).

And so on.

You can also do permission checks directly:
Code:
$xf.visitor.hasPermission('general', 'view')
 
$xf.visitor.user_id = Registered users only <-- is something list possible with a range of permission groups to be viewable to like .3,.4 etc??
 
Good morning, i've a problem, why if i put this code
HTML:
$xf.visitor.isMemberOf [(5, 3, 7)] AND !$xf.visitor.isMemberOf [(1, 2, 6)]
in Display Condition of my widget in which 1 are Unregistered Group they can see this widget... Thanks for support.
 
Last edited:
The syntax is wrong.
Code:
$xf.visitor.isMemberOf([5, 3, 7]) AND !$xf.visitor.isMemberOf([1, 2, 6])
You can probably simplify this, though.

You probably only need:
Code:
$xf.visitor.isMemberOf([5, 3, 7])

Or:
Code:
!$xf.visitor.isMemberOf([1, 2, 6])

But not both.
 
The syntax is wrong.
Code:
$xf.visitor.isMemberOf([5, 3, 7]) AND !$xf.visitor.isMemberOf([1, 2, 6])
You can probably simplify this, though.

You probably only need:
Code:
$xf.visitor.isMemberOf([5, 3, 7])

Or:
Code:
!$xf.visitor.isMemberOf([1, 2, 6])

But not both.
Well done thanks! It still work perfectly!
 
Thanks a lot for your comments, they were very helpful. But I have a question. How do I distinguish group numbers? Which is 1, 2 etc.
 
Top Bottom