WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Contact Form for each author?? (7 posts)

  1. TC.K
    Member
    Posted 1 year ago #

    Hi,
    I have a multi author blog site. Instead the reader contact the author through the site-wide contact form, I want each author has their own contact form so the reader can easily reach them.

    Can CF7 do this?

    Thanks

    http://wordpress.org/extend/plugins/contact-form-7/

  2. shoegazergirl
    Member
    Posted 1 year ago #

    I have the same question, thank you.

  3. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    Special Mail Tags

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

  4. TC.K
    Member
    Posted 1 year ago #

    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?

  5. TC.K
    Member
    Posted 1 year ago #

    I got this problem solved by referring to this page.

  6. schwarzgrau
    Member
    Posted 1 year ago #

    [_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...

  7. schwarzgrau
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic