UserModel::getEmailWelcome PHP Method

getEmailWelcome() protected method

Resolves the welcome email format. Maintains backwards compatibility with the 'EmailWelcome*' translations for overriding.
protected getEmailWelcome ( string $registerType, object | array $user, array $data, string $password = '' ) : string
$registerType string The registration type. One of 'Connect', 'Register' or 'Add'.
$user object | array The user to send the email to.
$data array The email data.
$password string The user's password.
return string The welcome email for the registration type.
    protected function getEmailWelcome($registerType, $user, $data, $password = '')
    {
        $appTitle = c('Garden.Title', c('Garden.HomepageTitle'));
        // Backwards compatability. See if anybody has overridden the EmailWelcome string.
        if ($emailFormat = t('EmailWelcome' . $registerType, '')) {
            $welcome = formatString($emailFormat, $data);
        } elseif (t('EmailWelcome', '')) {
            $welcome = sprintf(t('EmailWelcome'), val('Name', $user), val('Name', val('Sender', $data)), $appTitle, externalUrl('/'), $password, val('Email', $user));
        } else {
            switch ($registerType) {
                case 'Connect':
                    $welcome = formatString(t('You have successfully connected to {Title}.'), $data) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Username'), val('Name', $user)) . '<br>' . formatString(t('Connected With: {ProviderName}'), $data) . '<br></p>';
                    break;
                case 'Register':
                    $welcome = formatString(t('You have successfully registered for an account at {Title}.'), $data) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Username'), val('Name', $user)) . '<br>' . sprintf(t('%s: %s'), t('Email'), val('Email', $user)) . '<br></p>';
                    break;
                default:
                    $welcome = sprintf(t('%s has created an account for you at %s.'), val('Name', val('Sender', $data)), $appTitle) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Email'), val('Email', $user)) . '<br>' . sprintf(t('%s: %s'), t('Password'), $password) . '<br></p>';
            }
        }
        return $welcome;
    }
UserModel