• Hi. I want to displat a contact form in author.php. This contact form will automatically catch the author’s email. So message send by visitor will be automatically send to the respective author’s email.

    I have been searching for so many hours but still can’t find any solution.
    And I have no knowledge of programming at all…

    Can someone help me?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi luckyman,

    You can use the Contact Form 7 plugin, which is very useful for creating all sorts of contact forms.
    In your form’s options, you will need to use the [_post_author_email] tag in the To: e-mail field so that the Form emails the author of the post in question.

    Hi,

    Did the plugin suit your needs?
    If so, and if you don’t have any questions, could you please mark this thread as resolved?

    Thanks!

    Thread Starter luckyman2011

    (@luckyman2011)

    Hi, Marventus.
    I’m very sorry for my late reply. It doesn’t work.
    When I put [_post_author_email] in the To: field and <?php echo do_shortcode( ‘[contact-form 1 "Contact form 1"]‘ ); ?> in the author.php, what I get when I click on the Send button is:
    “Failed to send your message. Please try later or contact administrator by other way.”

    I just don’t know why it doesn’t work. Did I miss a step?

    Hi,

    No worries about the late reply.
    I see you are using the right special tag. Try taking a look at the plugin’s FAQs (questions 11 and 12 to be exact), since they seem to directly address your issue.
    If that doesn’t work, you could try other contact form plugins, but chances are the issue lies with your server’s email client.
    That’s all I got. Let me know if there’s anything else you need help with.

    Good luck!

    Thread Starter luckyman2011

    (@luckyman2011)

    Hi, Marventus.
    I give up. It just doesn’t work…

    Nick

    (@nicholasdstevensmecom)

    I’m looking for the same functionality. Please let me know if you figure this out.

    I’m guessing that the [_post_author_email] tag won’t work on author.php because author.php is not a post. Maybe there’s a way to make Contact Form 7 think that it’s a post?

    Hi Nick,

    I tested Contact-Form-7’s [_post_author_email] special tag on one of my test sites and it worked well. Here’s my set up:
    WP: 3.2.1;
    CF7: 3.0;
    Other plugins: Exec-PHP 4,9, Role Manager 2.2.3.
    The above plugins are necessary to run PHP inside posts, pages, and widgets.

    Here’s what you should do:

    1. Create a form in CF7.

    2. Under ‘E-mail’ options, type [_post_author_email] inside the ‘To’ field. If you would like to include the name of the author in that field as well, type this instead:

    [_post_author]<[_post_author_email]>

    3. Check the ‘Use HTML content type’ box, and rewrite the message body in HTML. Here’s the default CF7 e-mail in HTML:

    <p>From: [your-name] <[your-email]></p>
    <p>Subject: [your-subject]</p>
    <p>Message Body:</p>
    <p>[your-message]</p>
    <hr>
    <p>This e-mail is sent via contact form on <a href="[url]">blog_name</a>.</p>

    ‘Blog_name’ should be replaced by the name of your blog.

    4. Insert the new CF shortcode inside your author.php file (the old shortcode should work too, but just in case use the newer one). Don’t forget to wrap it around the do_shortcode function like so:

    <?php echo do_shortcode('[contact-form-7 id="form_ID" title="Contact form 1"]'); ?>

    Replace ‘Form_ID’ by your CF’s ID and, if you wish, customize the title value to one of your liking.

    5. Load any of your author pages to see if the CF is being displayed properly. If it is, try it to make sure everything is working well.

    That should do it.

    Good luck!

    Hi Marventus,
    I’ve used your same method and it’s work for all user but not for the ADMIN user (the first one you create when setup wordpress).

    In my website I have other users that have the admin role and they work perfectly.

    Have you some ideas?

    thanks in advance

    t

    Hi Terenzi,

    I never encountered that problem before. Does the Admin user you are referring to have an ID of 1 (one)? You could try creating a new admin user with the same permissions as the old admin, deleting the old one, and assigning all comments and posts to the new admin.
    However, backup your database before you do so you can restore the User tables in case it does not work.

    Good luck!

    Hi,

    Were you able to figure this out? If so, could you please mark this topic as resolved?

    Thanks!

    I have done everything listed above and its not working at all. this is so frustrating

    FYI it is working with a post

    Marventus,
    Thank you so much for your help, this was a life-saver today, and worked perfectly!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Contact form that will catch the author's email automatically’ is closed to new replies.