I have the same question, thank you.
Special Mail Tags
You can use [_post_author]
and [_post_author_email]
for such cases.
Thread Starter
TC.K
(@wp_dummy)
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?
Thread Starter
TC.K
(@wp_dummy)
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