WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 » [Resolved] [Plugin: Contact Form 7] Contact Form for each author??

[Resolved] [Plugin: Contact Form 7] Contact Form for each author??

Viewing 6 replies - 1 through 6 (of 6 total)
  • I have the same question, thank you.

    Plugin Author Takayuki Miyoshi

    @takayukister

    Special Mail Tags

    You can use [_post_author] and [_post_author_email] for such cases.

    How about i want to implement the contact form in each of the author page (author.php)? Seem the contact form doesn’t allow [_post_author_email] tag. Is there anyway to do so?

    I got this problem solved by referring to this page.

    [_post_author_email] needs to be inside the loop. So doesn’t work on a author.php page it seems. And the solution ron_dev posted got the problem, that the email-adress got written in the html-source-code. By the way if you use Contact Form 7 – Dynamic Text Extension you got this problem too.
    It would be nice to got another special mail tag for this purposes.
    I tried it with

    $curauth = get_userdatabylogin($author_name);
    elseif ( '_author_email' == $name )
    $output = $curauth->user_email;

    and

    $curauth = get_userdata(intval($author));
    elseif ( '_author_email' == $name )
    $output = $curauth->user_email;

    inside of special-mail-tags.php but with no luck.

    It seems the only possibility without changing the code of CF7 is to use [_post_author_email] and create an empty loop on author.php and paste CF inside. But the author needs posts for that and it feels wrong.

    $autor = $curauth->user_nicename;
    $args = array(
    		'posts_per_page' => 1,
    		'author_name' => $autor
    		);
    
    query_posts($args);
    
    while ( have_posts() ) : the_post();
    echo do_shortcode( '[contact-form-7 id="442" title="my_form"]' );
    endwhile;

    Oh yeah, It feels so dirty…

    Would be nice to know how or when CF7 gets it’s variables, cause I can’t access the GET variables or the other variables on my author.php inside of special-mail-tags.php

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Contact Form 7] Contact Form for each author??’ is closed to new replies.
Skip to toolbar