I have created a view for the members of my site where i output several information from their user profile (name, homepage, etc.). One of this items is the email which they have previously introduced (in a correct way, eg. user@site.com). I also have created a phptemplate to modify how this view is output to the browser.
My problem is that when i print the e-mail field (which is the 'normal' form, eg user@site.com) the spamspan filter is not applied. If i put e-mail addresses in other pages the spamspan filter works correctly.
I should have missed something on applying filter to phptemplates. Can anyone point me on how to solve this issues? Thanks!
Comments
Comment #1
setack commentedJust found out how it works. Just print the text through the check_markup function provided by drupal (e.g
print check_markup($row[value], FILTER_FORMAT_DEFAULT, FALSE);).Cheers.
Comment #2
lakka commentedOr you could pass the text through the spamspan function:
print spamspan($row[value])Comment #3
setack commentedgreat! The solution proposed by lakka is much better as other filters will not be applied. Thanks.
Comment #4
wmike commentedHi,
Can anyone tell me where to to the suggested php code?
Many thanks!
Mike
Comment #5
Polyestersheep commentedHi,
I've got the same problem. SpamSpan filter isn't applied to the e-mail field. In fact I'm a newbie and don't have the slightest idea, where to put the code posted above. Maybe someone could give me a hint.
Thanks a lot.
Ronny
Comment #6
Polyestersheep commentedComment #7
lakka commentedIf you are using the email field, it has built in support for spamspan. Have a look at that project's page. If not, you will need to put the code into one of the theme template files. Have a look at the theming guide for information on how to use phptemplate. If you get stuck, try asking in the relevant forum - there will be lots of people there who can help you.
Comment #8
keva commentedFor anyone trying to use the spamspan filter with a user email in views:
- In the view, add the user:email field
- In Style Setting, click Theme: Information (this is Views 3, but there's a similar setting in Views 2)
- Listed are all possible template names for the view itself and its fields
- Notice the group that corresponds to the email field (something like "Field User: E-mail...")
- Copy the views-view-field.tpl.php file from the Views module into your theme directory
- Rename it one of the choices listed under the "Field User: E-mail..." group
- Replace the line
<?php print $output; ?>- With
<?php print spamspan($output); ?>- Upload the file and clear the theme registry.
Comment #9
orkutmuratyilmazI'm using OpenAcademy 7.x 1.0 and I've got an e-mail field in a view.
I've created a file under my themes directory named, views-view-field--field-person-email.tpl.php and I've checked that the file is working.
I've tried those line of codes, but none of them are working (@'s and .'s are not converted):
trial 1:
<?php print spamspan ($oputput); ?>trial 2:
<?php print spamspan ($oputput); print spamspan ("name@surname.com"); ?>What could I do?