WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Create a contact form on author.php to mail to author (8 posts)

  1. marluras
    Member
    Posted 2 years ago #

    Hi
    I appreciate your plugin, I would make it work on every author.php so that a visitor on the site who clicks on the author's name of a post could send a message to the author.
    I don't if I'm very clear - take a look on this the message should be sent to St├ęphane Bikialo and not to me.
    I tried several things, but most answers I found related to forms on posts.
    I think I have to do some short code supplement to the author template, but what?

    Any hint appreciated
    Regards
    Martin

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

  2. marluras
    Member
    Posted 2 years ago #

    precision, I use this short code in the author template

    <?php echo do_shortcode( '[contact-form-7 id="1234" title="Contact form 1"]' ); ?>

  3. marluras
    Member
    Posted 2 years ago #

    there is a variable in this author template : $curauth

    I tried this - inspired by sevenspark :
    add_shortcode('CF7_get_curauth_email', 'get_curauth_email'); into/ or after the contact-form 7 short code

    and in the contact-form 7
    [dynamichidden recipient-email "CF7_get_curauth_email" ]

    EMAIL
    to:
    [recipient-mail|

    But it doesn't work

  4. marluras
    Member
    Posted 2 years ago #

    the only one that's working is to enter my mail instead of [recipient-mail] into the contact-form7, but this means that all messages on all author pages are sent to me and not to to a particular author, other than me.

  5. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    and in the contact-form 7
    [dynamichidden recipient-email "CF7_get_curauth_email" ]

    EMAIL
    to:
    [recipient-mail|

    Shouldn't it be [recipient-email]? Not mail.

  6. marluras
    Member
    Posted 2 years ago #

    yes, you're right, but it doesn't work either

  7. marluras
    Member
    Posted 2 years ago #

    Perhaps the problem is here (author.php), I did this

    <?php add_shortcode('CF7_get_curauth_email', 'get_curauth_email'); ?>
    <?php echo do_shortcode( '[contact-form-7 id="120" title="Contact auteur"]' ); ?>

    I don't know how to associate the two short codes

  8. marluras
    Member
    Posted 2 years ago #

    \\This is the complete code of author.php where the variable $curauth is set

    <?php get_header(); ?>

    <div id="content" class="entry">

    <div class="post-content">
    <?php userphoto($wp_query->get_queried_object()) ?>

    <!-- This sets the $curauth variable -->

    <?php
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>

    <h2><?php echo $curauth->nickname; ?></h2>

    <?php echo $curauth->user_description; ?>

    <p>user_url; ?>"><?php echo $curauth->user_url; ?></p>

    <h2>Envoyer un message :</h2>

    <?php echo do_shortcode( '[contact-form-7 id="120" title="Contact auteur"]' ); ?>

    </div>

    </div>

    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic