XF 2.1 Set permissions to ununswared threads

markoroots

Well-known member
Hi there, I would like to add the unuswared threads view in the "What's New" tab, but I would like that this is been shown only to the staff.
So I have seen that this is the string code to add:
Code:
href="{{ link('find-threads/unanswered') }}" rel="nofollow">{{ phrase('unanswered_threads') }}</a>
    <a class="{$baseClass} {{ $pageSelected == 'watched' ? {$selectedClass} : '' }}"

in whats_new_wrapper.
But in this way is visible to all. How to set only some usergroup as for example "Supporters" and "Moderators"?
 
Hi,
Why don't you use conditional statements?

Like as;

For Display condition:
Code:
$xf.visitor.isMemberOf(123) AND !$xf.visitor.isMemberOf(456)

For templates:

Code:
<xf:if is="{{$xf.visitor.isMemberOf([x, y])}}">
    bla bla bla...
</xf:if>
 
Hi XDinc and thank you for your suggestion.
The only problem is that I don't know the code so is not simple to understand what you mean.
I have 2 usergroups that I need that this tab appear, one is the "Moderators" group and another is the "Supporters".
Can you please tell me what to add and where?
Thanks again
 
Hi XDinc and thank you for your suggestion.
The only problem is that I don't know the code so is not simple to understand what you mean.
I have 2 usergroups that I need that this tab appear, one is the "Moderators" group and another is the "Supporters".
Can you please tell me what to add and where?
Thanks again


Open Public navigation from ACP and add navigation.

1585569668847.png

You can change the display conditional (for your user group ID) (Example 123=staff 456=mod)

1585569771223.png

Save...

That's All

1585569918441.png
 
Great many thanks Xdinc, this your post should be collected in the guides of Xf. :)
Yes I was testing it but I have seen that in this way is present under the button "What's New" (Novità on my forum) in the top bar.
but I needed that when some one click on the What's NEW button it open only this window

Immagine.webp

and the ununswared threads are show here only to the staff.

So maybe I should add somthing here:

Code:
href="{{ link('find-threads/unanswered') }}" rel="nofollow">{{ phrase('unanswered_threads') }}</a>
    <a class="{$baseClass} {{ $pageSelected == 'watched' ? {$selectedClass} : '' }}"

in the whats_new_wrapper file, I have understand, but I really don't know if yes and in wich way to modify the code.

Thanks again
 
Maybe something like this in the template?

Code:
<xf:if is="{{$xf.visitor.isMemberOf([x, y])}}">
    href="{{ link('find-threads/unanswered') }}" rel="nofollow">{{ phrase('unanswered_threads') }}</a>
    <a class="{$baseClass} {{ $pageSelected == 'watched' ? {$selectedClass} : '' }}"

</xf:if>
 
It seems that is there a syntax error in the code, so maybe I have made something wrong :rolleyes:

Code:
<xf:macro name="links" arg-pageSelected="!" arg-baseClass="!" arg-selectedClass="!">
      
    <xf:if is="$xf.options.enableNewsFeed">
        <a class="{$baseClass} {{ $pageSelected == 'latest_activity' ? {$selectedClass} : '' }}" href="{{ link('whats-new/latest-activity') }}" rel="nofollow">{{ phrase('latest_activity') }}</a>
    </xf:if>
    <a class="{$baseClass} {{ $pageSelected == 'new_thread' ? {$selectedClass} : '' }}" href="{{ link('whats-new/posts') }}" rel="nofollow">{{ phrase('new_posts') }}</a> 
    <xf:if is="{{$xf.visitor.isMemberOf([x, y])}}">
    href="{{ link('find-threads/unanswered') }}" rel="nofollow">{{ phrase('unanswered_threads') }}</a>
    <a class="{$baseClass} {{ $pageSelected == 'watched' ? {$selectedClass} : '' }}"

    </xf:if>
    <!--[XF:links:after_thread]-->
    <!--[XF:links:end]-->
</xf:macro>
 
Last edited:
You can do it with this widget:
1) Use the setting of no replies to create an Unanswered widget.
2) Set your permissions.
3) Add to What's New.
 
Back
Top Bottom