WordPress.org

Ready to get started?Download WordPress

Forums

Using "comment_type" field for my own purposes (6 posts)

  1. Greg
    Member
    Posted 4 years ago #

    I have a current project where I would like to support different kinds of comments and display them differently in the theme. I know that the "comment_type" field in the wp_comment table is normally used for pingback/trackback, and empty for normal comments (at least, this is what I read in the codex).

    Is this true, and would it be safe to use the "comment_type" field to distinguish between different types of normal comments?

    Thanks.

  2. Greg
    Member
    Posted 4 years ago #

    Been a while, so I thought I would bump. Is it safe for me to use the comment type field in the wp comments table for my own custom purposes?

  3. Greg
    Member
    Posted 4 years ago #

    One last try... Anyone?

  4. dgreengod
    Member
    Posted 4 years ago #

    Dear rebootnow.
    I got to conclusion that my site also require few types of comments.
    I am planning to implement that next week.
    If you want I could update you with my researches regarding the subject.

    Also it would be great if You succeed doing that and ready to share your experience.

    My direct mail is admin@worldphotoshots.com

  5. Chris Bratlien
    Member
    Posted 4 years ago #

    Hello,
    I'm planning on doing typed comments as well using the types: [agree,disagree,discuss,bibliography]

    in combination with using the maximum 10 levels of nested comments turned on in Dashboard > Settings > Discusssion.

    Sort of an argument/debate mapping theme.

    Here's what I've had to do so far:

    mytheme/comments.php - just give a radio input where the user can choose which type of comment they're inputting.

    And then in mytheme/functions.php

    function debate_comment_types($commentdata) {
      $comment_type      = ( isset($_POST['type']) ) ? trim($_POST['type']) : null;
      $commentdata['comment_type'] = $comment_type;
      return $commentdata;
    }
    add_filter('preprocess_comment','debate_comment_types');

    Sorry to the original poster, I don't know the "safety" of repurposing that field. Although it seems perfect for what I'm trying to do.

  6. stoi2m1
    Member
    Posted 4 years ago #

    @chrisbratlien.

    I have looked high and low for a way to set the comment type and this finally helped me do it.

    Thanks for sharing this piece of code'
    Jesse

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.