Page 1 of 1

Re: Displaying the number of comments pending?

Posted: Tue Jul 03, 2007 4:46 pm
by garvinhicking
Hi!

Nice idea. Sadly, there is no smarty function to achieve this. But you can use the PHP function serendipity_fetchComments() and pass an additional SQL where string to it to filter for "pending" comments only, then count the number of returned rows. You could write a custom smarty functions for that and put it in your template's config.inc.php file.

Do you know how to achieve that? I think you're already quite far with stuff like that, so I saved myself to create it for you... :)

Best regards,
Garvin

Posted: Tue Jul 03, 2007 8:39 pm
by garvinhicking
Hi!

Try this:

Code: Select all

$comments = serendipity_fetchComments($params['entry'], null, '', false, 'NORMAL', ' AND co.status = \'pending\'');

the ShowAll parameter should not be set to true, I think.

Regards,
Garvin

Posted: Tue Jul 03, 2007 8:58 pm
by garvinhicking
Exactly this is the reason why it should NOT be using that. The status can only EITHER be 'approved' OR 'pending'! It cannot be both. If your SQL-statement filters for "pending", the function should not first filter for 'approved'. :)

Best regards,
Garvin