[TYPO3-mvc] HowTo output usergroup from fe_user
Thomas Nussbaumer
typo3 at thomasnu.ch
Thu May 2 18:42:46 CEST 2013
> Result: Works: {user.username}, {user.password}
> No output: {user.usergroup.title}, {user.usergroup.description}
Hi, see http://api.typo3.org/extbase/60/
public getUsergroup()
Returns the usergroups. Keep in mind that the property is called
"usergroup" although it can hold several usergroups.
You need something like: <f:for each="{users.usergroup}" as="group">
...{group.title} ...{group.description}
Greetings, Thomas
Am 01.05.2013 18:56, schrieb Heinz Schilling:
> Hi
>
> I tried several tips from the internet but nothing works. I extend
> fe_user in my Extbase 6.0 / Fluid 6.0 Extension and want to output
> usergroup.
>
> File: Vendor/Myextension/Classes/Domain/Model/User.php
> class User extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser {
> }> Result: Works: {user.username}, {user.password}
> No output: {user.usergroup.title}, {user.usergroup.description}
>
> File: Vendor/Myextension/Classes/Domain/Repository/UserRepository.php
> class UserRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
> }
>
> File: Vendor/Myextension/Classes/Controller/UserController.php
> class UserController extends
> \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
> /**
> * userRepository
> *
> * @var \Vendor\Myextension\Domain\Repository\UserRepository
> * @inject
> */
> protected $userRepository;
>
> /**
> * action list
> *
> * @return void
> */
> public function listAction() {
> $users = $this->userRepository->findAll();
> $this->view->assign('users', $users);
> }
> }
>
>
> File: Vendor/Myextension/Configuration/TypoScript/setup.txt
> plugin.tx_myextension {
> persistence {
> classes {
> Vendor\Myextension\Domain\Model\User {
> mapping {
> tableName = fe_users
> recordType = Tx_Extbase_Domain_Model_FrontendUser
> }
> }
> }
> }
> }
>
> File: Vendor/Myextension/Resources/Private/Templates/User/list.html
> <table>
> <f:for each="{users}" as="user">
> <tr>
> <td>{user.username}</td>
> <td>{user.password}</td>
> <td>{user.usergroup.title}</td>
> <td>{user.usergroup.description}</td>
> </tr>
> </f:for>
> </table>
>
> Result: Works: {user.username}, {user.password}
> No output: {user.usergroup.title}, {user.usergroup.description}
>
> What did I miss? I hope, someone can help.
>
> Greetings, Heinz
More information about the TYPO3-project-typo3v4mvc
mailing list