I'd like to send an Email on a form submit. I have the mail code written in PHP, so on a submit of the form it sends an Email to the specified Email address. Now I'd like to have it send to the current Email set for an specified user. Can I somehow get the users email address in PHP?
dawa Yes, you can take a look at the UserCollectionModel class in the API reference.
mad Looks like what I was searching for. Now when I use $user = \Automad\UI\Models\UserCollectionModel::getUser($userName); I get Fatal error: Uncaught Error: Using $this when not in object context.... Am I using it wrong?
$user = \Automad\UI\Models\UserCollectionModel::getUser($userName);
Fatal error: Uncaught Error: Using $this when not in object context...
dawa Hi, like the error says, it needs an object. That class has a constructor and can be used as follows:
$UserCollection = new UserCollectionModel();
$User = $UserCollection->getUser('...'); // Can be name or email.
$email = $User->email;
Powered by FreeFlarum.(remove this footer)