php - TYPO3: Save and edit the first & last name of an FE user

45

I created an extension with the extension builder which extends the FE user model.

To access the fields, I added the properties inside the extension builder accordingly. This worked great withcity,zip,address etc. Unfortunately, you can't enter underscores, so I couldn't addfirst_name andlast_name to the properties. I addedfname andlname (inside the ext. builder) instead and renamed everyfname andlname tofirst_name andlast_name by hand (inside the code).

I hope you could follow me until now.

Because the problem is, when adding a FE user through the new action in the frontend, the first and last name won't be saved. But you can save them without a problem in the backend.

Any ideas how to fix that?

119

Answer

Solution:

Use the extbase conventions for field names (lower camel case in model classes, e.g.$firstName and$lastName). If you do this, they will automatically mapped to the database fieldsfirst_name andlast_name, which is also the reason for the restriction in theextension_builder. If you don't want to do this, you have to configure the mapping of field name to database field manually in your TypoScript configuration.

Alternatively, you can just use the properties and accessor methods provided by the extbaseFrontendUser model, from which you inherit - no need to implement that stuff yourself.

People are also looking for solutions to the problem: php - Becs character set regex

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.