• Resolved ironlion37

    (@ironlion37)


    Hi, I have a custom post type and I want to generate a contact form that can send a message to the email address of the user who created the post.

    In other words, my site has listings. Each listing is associated with an individual WordPress user. I want to have a contact from on each listing that messages the user/owner of the listing. So I need to dynamically pull that email address bases on which listing (post) is being viewed.

    Is this the plugin for the job? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ironlion37

    (@ironlion37)

    I found this in this documentation, which is what I need:

    [dynamictext dynamicname “CF7_get_current_user key=’user_email’ obfuscate=’on’”]

    However, it looks like I can’t use this shortcode in the “to” field on the Mail Tab in CF7. I get an “invalid mailbox syntax” error.

    Thread Starter ironlion37

    (@ironlion37)

    Nevermind. CF7 already has a post email shortcode.

    If you use a dynamictext or dynamichidden form tag to populate the “to” field in the email template, Contact Form 7 will display that validation error.

    If it’s not email*, you’ll see an error because [your-email] can be empty or a non-email value. These are examples of bad form-tags:

    [email your-email] // Email, but not required
    [text* your-email] // Required, but not Email
    [select your-email “john@example.com” “johnjr@example.com”] // Not required

    Contact Form 7 Documentation


    It is something I’ve been interested in looking into with a future update.

    If you’re using Contact Form 7 version 7.4.4 or above, you can add this to your wp-config.php file to suppress those pesky warnings:

    define('WPCF7_VALIDATE_CONFIGURATION', false);

    You can learn more about CF7’s configuration validator in their FAQ documentation here.

    However, since your user is a WordPress user and the form is only available to logged-in users, you can use the email form tag with built-in attributes:

    [email* your-email default:user_email]

    Using that, the CF7’s validator will be satisfied. Cheers!

    Learn more about setting default values to the logged-in user in CF7.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Post Author email?’ is closed to new replies.