Forums / Setup & design / How to check if content author/owner is in my user group?
Aleksander Lech
Monday 20 February 2006 2:08:07 am
Hi there - as I ask above: I'd like to check if author/owner of given object belongs to my user group.I can get:
{def $user=fetch( 'user', 'current_user' )} Group(s): {$user.groups|implode(', ')} <br />
and this lists groups I belong to, but how to check if content author belongs to one or more of my user groups?
GreetzAleksander
Wednesday 22 February 2006 12:41:23 am
Well, searching brings no solution :(
Shows current users' groups, but I want to get groups of user with for example id=523
I didn't find apropriate function :( Function user - according to docs - can fetch current_user but how to fetch user of given id??
Aleksander
Ćukasz Serwatka
Wednesday 22 February 2006 1:21:54 am
You can fetch user object, then access user_account. Try with this code:
{ * Replace user_account with your attribute user account name * } {def user_object=fetch( 'content', 'object', hash( 'object_id', 14 ) )} {$user_object.data_map.user_account.content.groups|attribute(show,1)}
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog