Wednesday 18 August 2010 8:09:26 am
First of all, you need to note that a user can 'belong' to several groups, because a user object can have several locations. supposing you're working only with the main location, you can do something like
$userObject = $user->attribute( 'contentobject' );
$userMainNode = $userObject->attribute( 'main_node' );
$userGroup = $userMainNode->attribute( 'parent' );
$userGroupName = $userGroup->attribute( 'name' ); // and this will be the name of the user group once you have $userGroup, you can easily get its dataMap and play with it. Note also you don't need all those lines. you can do it just like
$userGroupName = eZUser::currentUser()->attribute( 'contentobject' )->attribute( 'main_node' )->attribute( 'parent' )->attribute( 'name' ); hope this works for you.
|