Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Emailing image $Avatar

Go to End



Community Member, 267 Posts

28 January 2012 at 12:52am

Edited: 28/01/2012 12:53am


I have memberprofiles in place with a registerform on the front-end. People can register and they get added to the Member table. I also have forum module installed, and therefor Member table is extended with a Avatar. People can upload an Avatar in the registration form. This all works, and you can view the avatar in your online profile or in the CMS (as admin).

After registration a few emails get send: 1 to Admin, 1 to user.

Ok now my issue:
in the emails i would like to include the avatar.. but how?

ive tried lots of things, like

                    <% control AvatarID %>
                        <img src="$SetWidth(150).Link" />
                    <% end_control %>
                    <% control Avatar %>
                        <img src="$SetWidth(150).Link" />
                    <% end_control %>
		<img class="userAvatar" src="$FormattedAvatar" alt="Avatar" /><br />

but they all result in a broken path/link for the image source..

How do i include the avatar in the data that gets send?

my email function:

	function onBeforeWrite() {

        if (!$this->owner->exists()) {

			$AdminEmail = new Email();
			$AdminData = $this->owner->getAllFields();
			$AdminToAddress = Email::getAdminEmail();
			$AdminEmail->setSubject('Nieuw lid: Activatie vereist');
			$UserEmail = new Email();
			$UserData = $this->owner->getAllFields();
			$UserFromAddress = Email::getAdminEmail();
			$UserEmail->setSubject('Uw account is aangemaakt');