I just committed the first revision of the hidemailto module for you guys to test :)
Run the following inside your silverstripe install:
svn co http://svn.silverstripe.com/open/modules/hidemailto/trunk hidemailto
Then, follow the instructions at the top of the hidemailto/code/HideEmail.php file to implement it :).
Summary: There are currently two ways to implement, either by passing a member ID or an email address in the format user/domain/subject.
If you're listing a bunch of members on your site, and want a link to email them, you can use the following code:
[html]<!-- This is some control that returns Member objects -->
<% control Members %>
<!-- No default subject -->
<a href="$HideEmailLink" title="Email $FirstName (opens your favourite mail client)">Email $FirstName</a>
<!-- A default subject of Hi there! -->
<a href="$HideEmailLink/Hi there!" title="Email $FirstName (opens your favourite mail client)">Email $FirstName</a>
<% end_control %>[/html]
You can also insert links manually - via the CMS or hard-coded into your templates - by using the format mailto/user/domain/subject, where:
- user means the part before the @ sign - e.g. for [email protected], it will be 'matt'
- domain means the part after the @ sign - e.g. 'silverstripe.com'
- subject is optional, and is the default subject that is loaded (it can be changed by the user)
Hope this helps someone :)
edit: I've tested this on SilverStripe 2.1.0, and it requires the DataObjectDecorator extensions that were built for the gallery module.