Page 1 of 1

bug within serendipity_event_dashboard...maybe

Posted: Fri Dec 30, 2011 9:05 am
by bernd_d
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 5651 times
2011-12-30_090235.png
2011-12-30_090235.png (4.87 KiB) Viewed 5651 times
serendipity_event_dashboard version 0.6.2
Serendipity 1.6

Re: bug within serendipity_event_dashboard...maybe

Posted: Sat Dec 31, 2011 4:47 pm
by mattsches
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:

Re: bug within serendipity_event_dashboard...maybe

Posted: Sat Dec 31, 2011 5:33 pm
by garvinhicking
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

Re: bug within serendipity_event_dashboard...maybe

Posted: Sat Dec 31, 2011 5:59 pm
by mattsches
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;

Re: bug within serendipity_event_dashboard...maybe

Posted: Mon Jan 02, 2012 1:17 pm
by bernd_d
Thank you for your answers :) So i'll wait for an update of dashboard.

Re: bug within serendipity_event_dashboard...maybe

Posted: Mon Jan 02, 2012 4:26 pm
by garvinhicking
Hi!

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

Regard,s
Garvin

Re: bug within serendipity_event_dashboard...maybe

Posted: Tue Jan 03, 2012 7:30 pm
by mattsches
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:

Re: bug within serendipity_event_dashboard...maybe

Posted: Tue Jan 03, 2012 9:30 pm
by blog.brockha.us
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.. ;))

Re: bug within serendipity_event_dashboard...maybe

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

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.

Re: bug within serendipity_event_dashboard...maybe

Posted: Wed Jan 04, 2012 10:18 am
by garvinhicking
Hi!

That sounds about right, thanks for looking. %-)