WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Email Address Encoder] Encoding e-mails from custom fields

[Resolved] [Plugin: Email Address Encoder] Encoding e-mails from custom fields

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Till Krüss
    Participant

    @tillkruess

    Sure, just read the FAQ section: “How can I filter other parts of my site?”

    Thank you for reply, but can you tell me precisely what should I do? I’m not a coder and this is why i just need more complex solution, than the right direction 🙂

    The code in single.php:
    <p><a href="mailto: <?php the_field('mail'); ?>"target="_blank"><?php the_field('mail'); ?></a></p>

    How to use eae_encode_emails function to filter this?
    Thanks for help.

    Plugin Author Till Krüss
    Participant

    @tillkruess

    That should do it:

    <p><a href="<?php echo eae_encode_str('mailto:'.get_field('mail')); ?>"><?php echo eae_encode_str(get_field('mail')); ?></a></p>

    Thank you, works great!

    captainbr
    Member

    @captainbr

    I also have Advanced Custom Fields installed.

    In Simple.php I replaced
    <a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a> <br />
    with
    <p><a href="<?php echo eae_encode_str('mailto:'.get_field('mail')); ?>"><?php echo eae_encode_str(get_field('mail')); ?></a></p>
    and it is not encoding the address.

    The page is http://sidneybcdirectory.com/hagens-computers/

    Plugin Author Till Krüss
    Participant

    @tillkruess

    Your code seems to use your own $email variable, try this:

    <a href="<?php echo eae_encode_str( 'mailto:' . $email ); ?>"><?php echo eae_encode_str( $email ); ?></a>

    captainbr
    Member

    @captainbr

    Thanks for the quick response. I inserted your code and I can still see plain text when I view the source.

    Here is my code<p><a href="<?php echo eae_encode_str( 'mailto:' . $email ); ?>"><?php echo eae_encode_str( $email ); ?></a></p> <br />

    Should the extra spaces be present?

    Thanks for your help.

    Plugin Author Till Krüss
    Participant

    @tillkruess

    The extra spaces are just easier to read.

    If you call the function eae_encode_str() you output will be encoded for sure. Maybe you site is cached?

    You cannot use Firebug, Web Inspector or Dragonfly, to test the encoding, because they decode decimal/hexadecimal entities into plain text. To make sure your email address is encoded, right-click/secondary-click the page, click “View Source”, “View Page Source” or “Source” and search for any plain text email addresses.

    captainbr
    Member

    @captainbr

    Hi Till, I am not using any caching as far as I know. I have refreshed the page and also used F5.

    I have looked on my site on another computer which has never viewed the site. I am using View Page Source and the plain text is still visible.

    Plugin Author Till Krüss
    Participant

    @tillkruess

    Well, then the only reason I can come up with is that you’re editing the wrong file, because everything that gets passed through eae_encode_str() will be encoded. Sure you’re editing the right file?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] [Plugin: Email Address Encoder] Encoding e-mails from custom fields’ is closed to new replies.