WordPress.org

Support

Support » Plugins and Hacks » Using “comment_type” field for my own purposes

Using “comment_type” field for my own purposes

  • 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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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?

    One last try… Anyone?

    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

    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.

    @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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using “comment_type” field for my own purposes’ is closed to new replies.