WordPress.org

Support

Support » Plugins and Hacks » Slick Contact Forms » [Resolved] [Plugin: Slick Contact Forms] Contacting post author?

[Resolved] [Plugin: Slick Contact Forms] Contacting post author?

  • Hi,

    I’ve set up the contact form to show only on post pages. I want the contact form to send the message to the post author. So far, I know the variable $emailTo retrieves the email where the message will be sent to.

    So I tried:

    $emailTo = get_the_author_meta('user_email');

    But it is not working. I guess it’s because the function is outside the WordPress loop. So, the proper code would be:

    $emailTo = get_the_author_meta('user_email', $author_id);

    But I don’t know how to get the user ID.

    Any ideas?

    Thank you

    http://wordpress.org/extend/plugins/slick-contact-forms/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author remix4

    @remix4

    Hi,

    Try checking on the WordPress Codex:

    http://codex.wordpress.org/

    Plugin Author remix4

    @remix4

    Hi,

    Try checking on the WordPress Codex:

    http://codex.wordpress.org/

    I have read all documentation related to the “out of the loop” thing. I googled almost everything I couldn’t think of and tried different approaches:

    1.

    $author_id=$post->post_author;

    2.

    global $post;
    $author_id=$post->post_author;

    3.

    $post_tmp = get_post($post_id);
    $author_id = $post_tmp->post_author;

    4.

    $author_id = $posts[0]->post_author;

    But none is working. So, I thought that the plugin may have some custom coding/function altering this :-/

    Thanks

    Did you try these for debugging:

    global $post;
    print_r( $post );

    to see what the $post contains (maybe you need to use a different field instead of $post->post_author to get the ID), and

    echo $post_id;

    to see if $post_id is set (get_post() doesn’t work without a proper ID argument).

    The key for finding the solution you’re looking for is to get a visual of what data you have or don’t have in order to see what exactly is missing.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Slick Contact Forms] Contacting post author?’ is closed to new replies.
Skip to toolbar