Displaying the number of comments pending?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Displaying the number of comments pending?

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply