Skip to content

Userfunc in email receiver typoscript do not work the same way since v13.2.0 #678

@mediaessenz

Description

@mediaessenz

We need to send a confirmation email to different addresses depending of the age of the user.

If a user is over 18 years of age, the email should be sent to them directly; otherwise, it should be sent to their legal guardian.

To do so, we enhanced the user model for the guardian name and email. Inside a user func we check the age depending of the given date of birth and return the corresponding mail recipient.

Before v13.2.0 this was possible like so:

email {
    createUserConfirmation {
        receiver {
            email = USER
            email {
                userFunc = Mediagear\Jdcompetition\UserFunc\Femanager->getReceiverEmailDependingOnAge
                default = email
                u18 = guardian1Email
            }
            name = USER
            name {
                userFunc = Mediagear\Jdcompetition\UserFunc\Femanager->getReceiverEmailDependingOnAge
                default = firstName
                u18 = guardian1Name
            }
        }
    }
}

Now, after updating femanager from v13.1.0 to 13.2.0 the $this->cObj->data inside the userFunc is empty.
Previously, it contained the user data received.

We need the possibility to change this behaviour by typoscript, because we have an other registration form which doesn't need this age check.

Unfortunately the Event BeforeMailSendEvent doesn't contain the typoscript, otherwise we could use this.

If you would add the typoscript as a public variable to the SendMailService, like the contentObject, it would be possible to get the needed values inside an event listener:

$typoscript = $event->getService()->typoscript;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions