1
votes

I need to create a custom FE user with some custom fields. Also, it needs to be assignable through the frontend to different user groups.

You can find my first approach here. Didn't work out that well.

Second approach was to create another extension and follow the guide which is shown here.

First thing I did was to add \TYPO3\CMS\Extbase\Domain\Model\FrontendUser into the Extend existing model class-field for my CustomFEU-model. Then I created another model which I named FEgroup and I mapped it to the table fe_groups. After that, I connected an n:m relation to the CustomFEU.

When I try to create a new CustomFEU with the new action, it returns a white empty page after submitting the form and no user is being added.

The only strange thing I found was that the /Classes/Domain/Repository/ folder is empty.

TYPO3 7.6.8

Although I didn't edit the files yet, here they are:
Model / Controller / Setup

Did anyone encounter similar problems?

1
Please inline your code - pastebin links can die. If you are getting a blank page, you are probably getting a fatal PHP error somewhere - check the error log, or enable displaying of errors in the frontend.Jost
"Empty white page" sounds like your system is not printing out errors/exceptions. Turn on display_errors in php and set your TYPO3 installation to the development preset to see whats going on. Also, are you talking about the newAction() or createAction() method going wrong?j4k3

1 Answers

3
votes

First you need to create the repositories that handle the new user and usergroup models.

Second you try to save the user with $this->customFEURepository->add($newCustomFEU); and the variable customFEURepository does not exist. It would be the best to inject it, it has to be the repository that you should create first. You can inject it like that:

/**
 * CustomFEUController
 */
class CustomFEUController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{

    /**
     * @var \Vendor\Feregistration\Repository\CustomFEURepository
     * @inject
     */
    protected $customFEURepository;

// other code ...
}

Don't forget to clear the system cache after adding inject annotations, otherwise it wont work.

Last but not least i can't see the mapping to the database table for your model. You need to add it to your TypoScript (setup.txt)

config.tx_extbase.persistence.classes {

    Vendor\Feregistration\Domain\Model\CustomFEU {
        mapping {
            recordType = 0
            tableName = fe_users
        }
    }

    Vendor\Feregistration\Domain\Model\FEGroups {
        mapping {
            recordType = 0
            tableName = fe_groups
        }
    }
}