XF 2.0 Widget limitations

Olli2k

Member
Hi there,
my current focus is on do some self permissions on some widget of mine.

I already found this thread: https://xenforo.com/community/threads/add-permissions-for-widgets.136384/#post-1187098

Exactly what I need, but it doesn't seem to be realized.

So I have found this piece of code in the mentioned thread:

There's two things that can help for right now.

1) Create the widget that you want, but don't assign it to a position. Give it a "widget key" for example "my_widget".
2) Create a new "HTML" widget in the desired position. Check the "Advanced mode" box. In the "Template" field type:
HTML:
<xf:if is="!$xf.visitor.user_id">
    <xf:widget key="my_widget" />
</xf:if>
That should give you the desired effect.

But what if I want to give access to several usergroups and not guests? And it is a existing php/addon widget? What do I need to add there?

The other case is, that I want to display same widget with diffrent content to diffrent user group.
Due to fact, that I need to do the limitation in the template, would be the following steps correct:

- Copy template to new one with diffrent name
- Copy definition class php file to new one with diffrent name and change renderer to new template name
- add xf:if user group code to both templates

Would this work?
Or would be creating new widget with new widget key and xf:if key for both widgets keys in template be enough?

Thanks in advance.
 
Top Bottom