e107help.org Q&A
0 like 0 dislike

I'm trying to add comments to my plugin but something isnt adding up. Plugin maker suggests that I use the function renderComments.. I dont know if Im missing something or not.

private function renderComments()




         * Returns a rendered commenting area. (html) v2.x

         * This is the only method a plugin developer should require in order to include user comments.

         * @param string $plugin - directory of the plugin that will own these comments.

         * @param int $id - unique id for this page/item. Usually the primary ID of your plugin's database table.

         * @param string $subject

         * @param bool|false $rate true = will rendered rating buttons, false will not.

         * @return null|string



        $plugin = 'game_reviews';

        $id = 1;

        $subject = 'My games item subject';

        $rate = true;


        $ret = e107::getComment()->render($plugin, $id, $subject, $rate);


        $ns->tablerender($ret['caption'],$ret['comment_form']. $ret['comment']);



e107 version 2.2.1
in Plugins by (33 points) 3 8 13
closed by

2 Answers

0 like 0 dislike
Best answer

Solved on Gitter. 

For future reference, the code to use is the following: 

        $plugin = 'game_reviews';

        $id = 1;

        $subject = 'My games item subject';

        $rate = true;

return e107::getComment()->render($plugin, $id, $subject, $rate);

This will be added to the developer documentation.  

(Update 15/04/2021: Updated above example code. Thanks Jimmi!) 

return e107::getComment()->render($plugin, $id, $subject, $rate);
by (2.8k points) 7 10 10
edited by
Moc, it is not working, moving to github.
Thanks, updated it with the correct code.

For future reference, see https://github.com/e107inc/e107/issues/4464
0 like 0 dislike
Did you add e_comment addon for your plugin? And then rescanned plugin directory?

EDITED. See comment bellow
by (2.0k points) 18 49 58
edited by
I guess I'm doing something wrong. How do I get the comment form to appear, etc? I guess it isn't as easy as just e107::getComment()->render();?
Can you share (part of) your code you use in a Gist? https://gist.github.com/
Then we can help you out better :)
Please find me on Gitter to have a chat. This is basic PHP stuff that is the issue, not e107 specific :) Your current code is messy and also very vulnerable to security risks.
996 questions
1,389 answers
2,512 users