Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Member celticshinobi's Avatar
    Join Date
    Nov 2012
    Location
    TN, USA
    Posts
    36
    Member #
    33858
    Liked
    1 times

    Unhappy Comment form posting the wrong stuff! Halp!

    I won't beat around the bush, PHP and I don't get along very well yet so I do my best to stay away.

    that being said, I'm working on a comment form on a wordpress blog and the form asks for a name, email, and a website - and when a person comments with those items filled it, it posts the website instead of the persons name at the top of the comment.

    Would anyone be willing to peek at the code and see what I've messed up? lol

    I've argued with it for hours it seems like and I haven't gotten anywhere.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    I'll save you a ton of headaches ....

    Use this WP plugin:
    https://wordpress.org/plugins/contact-form-7/


  4. #3
    Member celticshinobi's Avatar
    Join Date
    Nov 2012
    Location
    TN, USA
    Posts
    36
    Member #
    33858
    Liked
    1 times
    Haha, I do use that plugin actually..but I didn't know I could use it for blog comments?

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    Oh .... i missed the comment part.

    To edit what you're doing, you need to edit the page.php script, most likely.


  6. #5
    Member celticshinobi's Avatar
    Join Date
    Nov 2012
    Location
    TN, USA
    Posts
    36
    Member #
    33858
    Liked
    1 times
    Yeah, that's what I've been staring at but I'm not too sure what's going on...I see where the issue is at anyway, but I have no idea how to make it do something other than what its doing.

  7. #6
    Member celticshinobi's Avatar
    Join Date
    Nov 2012
    Location
    TN, USA
    Posts
    36
    Member #
    33858
    Liked
    1 times
    What's the best way to post up a page of code? or at least a snippet?

  8. #7
    Senior Member sasha_bolcina's Avatar
    Join Date
    Sep 2014
    Location
    Serbia
    Posts
    274
    Member #
    40099
    Liked
    47 times
    upload zipped files to post.

    Did you try to change input name? Maybe actual input name is reserved, or something like that....

  9. #8
    Member celticshinobi's Avatar
    Join Date
    Nov 2012
    Location
    TN, USA
    Posts
    36
    Member #
    33858
    Liked
    1 times
    I'm not too sure...i feel like the issue is around lines 110-111...at least that's what my code editor is showing them as, i dont know why, because that's 5 lines of code showing as 2 LOL...(div class bg-blog-input new-left push..etc.)

    Ill zip it and upload it with this comment, im still at a loss ><
    Attached Files Attached Files

  10. #9
    Senior Member sasha_bolcina's Avatar
    Join Date
    Sep 2014
    Location
    Serbia
    Posts
    274
    Member #
    40099
    Liked
    47 times
    I've seen immediately the problem. You cannot return html from function.

    Use heredoc construction like:

    return <<<HTML
    <span>{$comment->comment_author}</span>
    <p>{$comment->comment_date}</p>
    HTML;

    Prepare needed variables before return and just include results in heredoc like {$resultVar}

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    I see something odd .... may not be the actual solution to your problem ... but it is something not right ...

    Look at the scripting below ...

    3 sections .... Name, Email, Website

    But look closer....
    Name and Website use the SAME variable names

    name="author" id="author"

    That can't be right.

    I would expect the Website section to be something like: name="website" id="website"

    But whatever variable name you use, it has to match in the other parts of the script.

    PHP Code:
                        <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform contact-form" onSubmit="return checkForm();">
                    <?php if ( !$user_ID ){?>
                        <div class="form-blog-input left">
                            <div class="bg-blog-input left">
                            <span><?php if($req) echo _e('Name (required)'tk_theme_name); ?></span>
                            <input class="contact_input_text" type="text" onfocus="if(value==defaultValue)value=''" onblur="if(value=='')value=defaultValue" name="author" id="author" value=""/>
                            <div class="down-border-form left"></div>
                            <!--/down-border-form--></div>
                            
                            <div class="bg-input new-left">
                            <span><?php if($req) echo _e('E-mail (required)'tk_theme_name); ?></span>
                            <input class="contact_input_text" type="text" onfocus="if(value==defaultValue)value=''" onblur="if(value=='')value=defaultValue" name="email" id="comment-email" value=""/><div class="down-border-form left"></div
                            ><!--/down-border-form--></div>
                            
                            <div class="bg-blog-input new-left push"><span>
                            <?php if($req) echo _e('Website'tk_theme_name); ?></span>
                            <input class="contact_input_text" type="text" onfocus="if(value==defaultValue)value=''" onblur="if(value=='')value=defaultValue" name="author" id="author" value=""/>
                            <div class="down-border-form left"></div>
                            <!--/down-border-form--></div>
                        </div>
    Last edited by mlseim; Oct 21st, 2014 at 07:59 PM.



Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Tags for this Thread

All times are GMT -6. The time now is 05:05 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com