WordPress.org

Ready to get started?Download WordPress

Forums

Email Encoder Bundle - Protect Email Address
[resolved] Doesn't work in custom fields? (6 posts)

  1. la_ri_za
    Member
    Posted 11 months ago #

    Hi,

    thanks for the great plugin! I've been using it for quite a long time now, but today I noticed that it (version 0.8) doesn't work in my custom fields content. I'd swear that it worked before. I wonder what has happened? Should it work with custom fields?

    http://wordpress.org/plugins/email-encoder-bundle/

  2. bridgetwes
    Member
    Posted 6 months ago #

    I also needed this and found the following in the help tab (drop down at top of Email Encoder Bundle admin page):

    Encode the given email (other params are optional):
    <?php echo encode_email($email, [$display], [$method], [$extra_attrs]); ?>

    Encode the given content for emails to encode (other param is optional):
    <?php echo encode_content($content, [$method]); ?>

    If you are spitting out a custom field in a template, one of the above two methods should work to encode the email.

  3. freelancephp
    Member
    Plugin Author

    Posted 6 months ago #

    Exactly, this can be solved by using the template function.
    I will add it to the FAQ.

    Thanks Lariza and Bridget!

  4. masspamak
    Member
    Posted 5 months ago #

    Hello, i switched to your plugin recently also because I've think this thread would definitively fix my problem but I did not get it working in a specific case, i haver the following code in my template and would like to encode the email address, i can get it working when i call the encoding in plain text

    Send a email to <strong><?php $emailforrequest = get_post_meta($post->ID, 'emailforrequest', TRUE);
    echo eeb_email($emailforrequest, 'the support team'); ?></strong> to get help.

    this is ok ! But if i try to insert it in my "mailto" template as the following example it does not works.

    <a title=click here to open the email" href="mailto:<?php the_field('emailforrequest'); ?>?subject=the subject line&Body=my body content that may call other php function such as <?php the_title(); ?>"><img class="imgclass" title="imgtitle" alt="imgalt" src="imgsource.png" width="240" height="24" /></a>

    at this point i replaced

    <?php the_field('emailforrequest'); ?>

    with

    <?php $emailforrequest = get_post_meta($post->ID, 'emailforrequest', TRUE);
    echo eeb_email($emailforrequest, 'Mail Me'); ?>

    but it does not works at all.

    I've followed your FAQ and tips but cannot get it working, also i did not found the way to generate a mailto template to with PHP, it may works better as i could call each element (email, subject and body) with single PHP string and avoid to broke the encoding function.

    Many thanks for your help

  5. freelancephp
    Member
    Plugin Author

    Posted 5 months ago #

    You have to encode the whole mailto link. This should work:

    $mailto = '<a title="click here to open the email" href="mailto:' . get_field('emailforrequest') . '?subject=the subject line&Body=my body content that may call other php function such as ' . get_the_title() . '"><img class="imgclass" title="imgtitle" alt="imgalt" src="imgsource.png" width="240" height="24" /></a>';
    
    echo eeb_email_filter($mailto);
  6. masspamak
    Member
    Posted 5 months ago #

    Nice! It seems to work well and fit my -encoding- needs!

    I still have a problem with the ' sign used in the Email template that broke the php code (you know those " and ' around) but i will find the way to get it working.

    My last question would be: a bot or spambot could get or use this mailto linked image to spam around?

    Actually my mailto image is hidden in a DIV that user have to unhide by clicking a #link, but i would like to avoid this user action by having the mailto image available to users as soon they land on my page (visitors only and not bot, of course).

    Many thanks for your support and for this plugin that really works.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.