Filter comments by custom field? (help with first plugin ever) (1 post)

  1. zergu
    Posted 5 years ago #

    Hello. I am new to this forums and WordPress plugins. Lately I was trying to use qTranslate plugin to i18nize my blog content. It works quite nice but it has one big flaw. Comments written under a post in one language appear in all translations. I couldn't find a solution for this it so I decided to write a fix-plugin.

    I've managed to:
    1. Extend comment form with custom lang field using comment_form_default_fields filter.
    2. Save new field using comment_post action hook.
    3. Filter out comments in different language using comments_array action hook.

    It's almost working. Problem is with comments_array which has already retrieved comments from database. It would be more optimal to filter db retrieval itself, but I don't know how to do this. The other problem is with comment counting. I am only not displaying "wrong" comments and array item count always stays the same. So my page can say '50 comments' and show none. :(

    Do you now any solution to modify db query which retrieves comments (using commentmeta to filter) from within a plugin?

    Current plugin code: http://pastie.org/1320263

Topic Closed

This topic has been closed to new replies.

About this Topic