bug within serendipity_event_dashboard...maybe

Creating and modifying plugins.
Post Reply
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

bug within serendipity_event_dashboard...maybe

Post by bernd_d » Fri Dec 30, 2011 9:05 am

Hi!

Even if there is an comment, waiting vor approval within comments-section, it isn't shown in dashboard :(
2011-12-30_085849.png
2011-12-30_085849.png (7.27 KiB) Viewed 3495 times
2011-12-30_090235.png
2011-12-30_090235.png (4.87 KiB) Viewed 3495 times
serendipity_event_dashboard version 0.6.2
Serendipity 1.6

mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by mattsches » Sat Dec 31, 2011 4:47 pm

First of all, please check the "Number of pending comments to show" in your plugin settings and make sure it's greater than 0.

I've been looking at the plugin source code and maybe found the problem. But I need to ask other developers for help: What are the possible values for the status field in the comments table? Or, the other way round: What does a status = 'confirm' mean? And are there any more values besides 'approved', 'pending', and 'confirm'?

Garvin? :wink:

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by garvinhicking » Sat Dec 31, 2011 5:33 pm

Hi!

I believe approved, pending and confirm are the only ones. Approved comments are shown; pending are hidden and waiting for moderation. "confirm" is similar to pending, but means not the admin/owner of the blog needs to confirm, but the comment author himself.

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/

mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by mattsches » Sat Dec 31, 2011 5:59 pm

Ok, thanks Garvin, this could be the problem here. I will commit a fix later (or next year :roll: ).

Oh, and one more thing: Looking at serendipity_fetchComments I found the following code

Code: Select all

              ORDER BY
                    " . ($where != '' ? '' : 'co.id') . " " . ($order != '' ? $order : '') . "
$order and $where are both passend to the function as parameters. However: If $order is an empty string, but $where isn't, the resulting SQL will be invalid, right?

Code: Select all

SELECT ... FROM ... WHERE ... ORDER BY;

bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by bernd_d » Mon Jan 02, 2012 1:17 pm

Thank you for your answers :) So i'll wait for an update of dashboard.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by garvinhicking » Mon Jan 02, 2012 4:26 pm

Hi!

I believe the code currently suggest that order can only be used, if where is also used...

Regard,s
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/

mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by mattsches » Tue Jan 03, 2012 7:30 pm

bernd_d wrote:Thank you for your answers :) So i'll wait for an update of dashboard.
Ok, I committed the update, it should be available via Spartacus tomorrow. If it doesn't fix your problem, please do tell :wink:

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by blog.brockha.us » Tue Jan 03, 2012 9:30 pm

garvinhicking wrote: believe the code currently suggest that order can only be used, if where is also used...
I stumbled on the same part of code. It is in fact the case, that $order is ignored if no $where is given, what seemed wrong to me, as you may want to order by date ASC or DESC in example but don't need no $where.. (well I wanted this.. ;))
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by blog.brockha.us » Wed Jan 04, 2012 12:06 am

Code: Select all

              ORDER BY
                    " . ($where != '' ? '' : 'co.id') . " " . ($order != '' ? $order : '') . "
Uh.. :shock:
If $where and $limit is set, but $order not, this produces:
ORDER BY LIMIT ..

That is wrong (and not understandable) code. I guess it should be

Code: Select all

              ORDER BY
                    " . (empty($order) ? 'co.id' : $order) . "
Order should not be related to where and I think the code above is a copy and paste error. Perhaps the author wanted

Code: Select all

              ORDER BY
                    " . ($order != '' ? '' : 'co.id') . " " . ($order != '' ? $order : '') . "
.. what produces correct output but is way too complicated.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: bug within serendipity_event_dashboard...maybe

Post by garvinhicking » Wed Jan 04, 2012 10:18 am

Hi!

That sounds about right, thanks for looking. %-)
# 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