XF 2.0 hasPermission for user

nanto

Member
Hello
I would like to display something in the post_macros template if the contributor author has the permission.
Like this:
Code:
<xf:if is="{{ $xf.user.hasPermission('forum', 'test') }}">
    Show content if user has the rights ...
</xf:if>
The version for the visitor works, but not for the user.
How are you?
Can someone help?
 
I already tried.
With $user I get this error message.
  • Template public:post_macros: Cannot call method hasPermission on a non-object (NULL) (src/XF/Template/Templater.php:907)
I also tried some others like $user_id and so on.
But I do not want to succeed.
 
For post_macros template should be $post.User.hasPermission('forum', 'test')
 
Back
Top Bottom