Support » Fixing WordPress » Cannot post to comment_parent

  • Currently I am developing my own custom WordPress theme, and I am having an issue with posting comments. Here is my code for my comment area, or the area where my guests can post their comments:

    <div id="comment-area">
      <h4><?php _e("Post Comment"); ?></h4>
      <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" name="comment" id="comment-form" method="post">
        <input type="text" name="author" id="author" placeholder="Your name (Required)" autocomplete="on" tabindex="1" class="txtinput" value="<?php echo $comment_author; ?>">
        <input type="email" name="email" id="email" placeholder="E-Mail (Required)" autocomplete="on" tabindex="2" class="txtinput" value="<?php echo $comment_author_email; ?>">
        <input type="url" name="url" id="url" placeholder="Website URL (Optional)" autocomplete="on" tabindex="3" class="txtinput" value="<?php echo $comment_author_url; ?>">
        <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="<?php echo $post_ID; ?>">
        <input type="hidden" name="comment_parent" id="comment_parent" value="0">
        <textarea name="comment" id="message-box" placeholder="Enter your comments here..." tabindex="4" class="txtblock"></textarea>
        <a href="#comment-area" onclick="clearCommentFields();"><div id="reset-button"><?php _e('Reset!'); ?></div></a>
        <input type="submit" name="submit" id="submit-button" tabindex="5" value="<?php _e("Submit!", "byrne-systems"); ?>" />
      </form><!-- #comment-form -->
    </div><!-- #comment-area -->

    Now my issue is with ‘comment_parent’. For whatever reason I am unable to post the ‘comment_parent’ field within wp_comments via this method. Whenever I post a comment within wp_comments, the comment_parent field automatically defaults to zero, regardless of how it is set. Currently I have a js function that changes the ‘0’ value that you see above to a ‘1’, and after I submit a comment ‘0’ is always placed within comment_parent. In addition, I am unable to post anything to ‘comment_type’ either, which I would like to do if I want to pull off what I am attempting to do.

    Ultimately, I am attempting to see if anybody out there is able to help me to understand ‘how’ to post to both ‘comment_parent’, and ‘comment_type’ within the ‘wp_comments’ table within the WordPress DB via a <form>. Thanks in advance.

Viewing 1 replies (of 1 total)
  • An update. I have sort of figured out an awful hack to get data within the ‘comment_type’ field via ‘wp-comments-post.php’, and I would surely appreciate any suggestions to streamline this hack, and get it out of ‘wp-comments-post.php’. What I did was add the following code, and commented out the following code in wp-comments-post.php.

    // User Added Code
    $comment_type	      = ( isset($_POST['comment_type']) ) ? trim($_POST['comment_type']) : null;
    // User commented code!
    //$comment_type = '';

    And this works, however, it wont as soon as I update WordPress, if I update WordPress. I would ‘love’ to run this within functions.php, however, I do not know how to initiate a function in functions.php “after” wp-comments-posts.php has done its thing, otherwise, I would not be asking for help. Again, I appreciate any guidance that anybody would be will to lend me. Thanks in advance.

Viewing 1 replies (of 1 total)
  • The topic ‘Cannot post to comment_parent’ is closed to new replies.