WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add custom fields to comment form? (12 posts)

  1. Mysmasken
    Member
    Posted 7 years ago #

    Hello! I've been looking for something that lets me add fields to my comment form.
    I would like users to review my posts, therefore I would like to add a couple fields like "plus", "minus"...
    Both radiobuttons and text fields.

    I tried to do it myself, but it's too complicated.

    Anyone knows if there is such thing?

  2. Mysmasken
    Member
    Posted 7 years ago #

    Anyone?

  3. red-star
    Member
    Posted 7 years ago #

    try to play with this. It will get you started.

    '<form method="post" name="somename" action="getdata.php">
    <input type="radio" name="someName" value="1">
    <input type="radio" name="someName" value="2">
    <input type="submit" name="button" value="Submit">
    </form>
    '

  4. Mysmasken
    Member
    Posted 7 years ago #

    I figured that much out. The problem is when it gets to inputing it into the database...
    Was wondering if someone had seen a plugin or a mod for it...

  5. red-star
    Member
    Posted 7 years ago #

    will this help U a little...
    'if($HTTP_POST_VARS['button'] == "Submit") {
    // form was submitted, since the value of 'button' is equal to 'Submit'
    switch($HTTP_POST_VARS['someName']) {
    case '1':
    // one radio button was selected code goes here
    break;
    case '2':
    // two radio button was selected code goes here
    break;
    default:
    // form was submittted but no radio button was selected code goes here
    break;
    }
    } else {
    // form was not submitted
    }

    '

  6. Mysmasken
    Member
    Posted 7 years ago #

    What I did was I looked everywhere it submitted comment_content and I copied it and did the same for my new field that was called comment_plus and comment_minus.
    But it gave me an erorr.
    Guess I will have to try again. I do understand some PHP, but not nearly enough I guess.

    I figured I have to do changes in wp-commentsrss2.php, wp-comments-post.php maybe in comment-functions.php and also in my themes comment-files.

    Gah. I've been looking thru all the posts on this and none of them are solved.

    Apparently there is a big need/want for a plugin like this, so if anyone feels tempted ;)

  7. Mysmasken
    Member
    Posted 7 years ago #

    I got it to work! Yay :D

  8. rsuplido
    Member
    Posted 7 years ago #

    Would you mind sharing how you did it?

    Thanks.

  9. ythibodeau
    Member
    Posted 7 years ago #

    I could use the answer too.

  10. ythibodeau
    Member
    Posted 7 years ago #

    Mysmaken, please share.

    Thousands of wordpressers would like to know how this can be done.

    Please!!

  11. IdeaShower
    Member
    Posted 6 years ago #

  12. moshu
    Member
    Posted 6 years ago #

    It would probably be more visible if you make your own post announcing it :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags