How to Add a Contact Form for Each Author Profile Page

This is advanced feature that we are rolling out with the 1.1.1 version of Polytechnic. It's still considered beta in the 1.1.1 version but we wanted to roll this cool feature out for our users. Please let us know if you have any feedback on this so that we can push this out of the beta stage and offer full support.


This was a feature request by one of our users. After researching this and digging into the code for a few days, I found that there was really no easy way to 01) Allow the form to automatically forward the message the author/user based on the author.php page and 02) Make this universal for all themes (free). The easiest, most straight forward way to achieve this, would be to create a form for each user > and add it as a user extension option > which would generate on the frontend. But if you have 100 authors, the work involved to keep this amount of contact forms up to date seems like a headache. And although this seemed like a fairly standard use of Contact Forms in WordPress, there were only a couple tutorials out there - and nothing that worked well out of the box.

So based on the notes/work provided by those authors (credit to Chris Mavricos for his article and SevenSpark for their helpful plugin Contact Form 7 Dynamic Text Extension, I was able to put together my own working example which I hope will solve this problem for others.

Note, this example is using OptionTree to insert the shortcode, but if you came across this and didn't have this option included in your theme - a simple do_shortcode in author.php should do the trick ;)


01 - Activate this beta version (1.1.1) of Polytechnic > install and activate the 01) CF7 plugin the 02) CF7 DTE plugin and the 03) Really Simple Captcha plugin.

02 - Navigate to Contact > Add New > and build your contact form with this (and fill out the other elements based on the screenshot provided)

Here's the markup:

<style type="text/css">
.faculty-captcha p, input.wpcf7-text {
  margin: 0;
.dual-contact.sixteen.columns {width: 100%; padding-top: 5px;}
.dual-contact .eight.columns {width: 48.917%;}
<div class="dual-contact sixteen columns alpha omega clearfix">
    <p class="eight columns alpha">Your Name (required)
        [dynamictext* your-name "CF7_get_current_user key='display_name' "] </p>
    <p class="eight columns omega">Your Email (required)
    [dynamictext* your-email "CF7_get_current_user key='user_email' "] </p>
    [text your-subject] </p>
<p>Your Message
    [textarea your-message] </p>
<div class="faculty-captcha">
    <p style="margin: 0;">Please fill in Captcha to submit your message.</p>
    <p class="three columns alpha theme_image center" style="padding: 5px;">[captchac captcha-694 id:captcha size:l]<p/>
    <p class="four columns">[captchar faculty-captcha "Enter Captcha Here"]</p>
    <p class="three columns">[submit "Send"]</p>
[dynamichidden email-author "authormail"]

And hit save.

03 - Then copy the generated shortcode >

Navigate to Appearance > Theme Options > Faculty Options > Toggle "Show the Faculty Contact Section" to On > Then paste the shortcode in the Contact Form 7 Shortcode text-area > and hit save changes.

That should provide you with the end result of this contact form being generated on all author pages at the bottom. None Polytechnic users, this is where you would add the do_shortcode to author.php.

If you look at the markup for the form in the screenshot, you'll see that this will auto generate the author's email in the form and in the To: section. Currently this is not being encrypted, but by adding the Really Simple Captcha plugin, you should be able to inhibit most standard bots from harvesting emails. Note, though, that it does still exists in the markup.

Let me know how that works for you guys and gals!