1

Some users on social sites still enter their email addresses on comment fields. I'm trying to prevent spammers from harvesting them by replacing the @ character with a graphic. That's really easy to do using the smiley module.

However, I use the text filter option "Convert URLs into links" which turns the email into a mailto link. The smiley filter now breaks the HTML.

I would like to not turn emails into links but keep turning urls into links. How could I do that?

2 Answers 2

2

The easiest way is to creat your own input filter. Do a PREG and obfuscate the email address. Assign this filter to your input formats, and make sure it runs before the URL-to-link one.

3
  • thanks. I don't think I could obfuscate it with a graphic if it gets turned into a link afterwards. I could replace @ with @ but but that could be hacked easily
    – uwe
    Commented Feb 19, 2013 at 6:38
  • Definitely, a custom input filter is by far the easiest solution
    – Clive
    Commented Feb 19, 2013 at 9:39
  • @MotoTribe If you obfuscate it before the URL-to-link filter runs, then it shouldn't get turned into a link. Look at the code for _filter_url. If the "@" isn't there, then it' won't match.
    – mpdonadio
    Commented Feb 19, 2013 at 12:09
0

Spamfree email module replaces email address with mailto links and obfuscates to js code for js supporting browsers and to image for non js browser thus preventing email harvest bots.

https://www.drupal.org/sandbox/abhiklpm/2465593

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.