[fixed]event_filter_entries interferes with plugin_recentent

Found a bug? Tell us!!
Post Reply
JWalker
Regular
Posts: 177
Joined: Mon Sep 12, 2005 4:14 pm
Location: Botevgrad, Bulgaria
Contact:

[fixed]event_filter_entries interferes with plugin_recentent

Post by JWalker »

Hi,

The serendipity_filter_entries breaks serendipity_plugin_recententries. When serendipity_filter_entries is installed, the other plugin, recententries, does not show its list of entries at the side bar. This happens when the filter is not applied (when All entries are requested via categories side plugin or first entering of the front page). After filter is applied (the titles of the postings are shown only), serendipity_plugin_recententries shows its 'recent entries list' as expected.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: event_filter_entries interferes with plugin_recententrie

Post by garvinhicking »

This is strange, the plugin_recententries does not contain any (visible) code where this could be caused frmo.

Are you using a clean version of this plugin, and which serendipity version are you using?

Can I see that on a URL somewhere?

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/
JWalker
Regular
Posts: 177
Joined: Mon Sep 12, 2005 4:14 pm
Location: Botevgrad, Bulgaria
Contact:

Post by JWalker »

Hi,

I am with 0.9beta1 but I am behind firewall in intranet so no public URL is available.

The versions:

Code: Select all

serendipity_event_filter_entries.php,v 1.3 2005/08/01 18:18:52
...
        $propbag->add('version',       '1.0');

Code: Select all

serendipity_plugin_recententries.php 346 2005-08-01 17:35:25
....
        $propbag->add('version',       '1.3');
I did some debugging:

This is control output operator:

Code: Select all

if (isset($entries) && is_array($entries)) {    // line 153 
            ..... 
} else {
            echo '<div class="serendipitySideBarDate">------</div><br />';
            echo '<div class="serendipitySideBarDate">isset($entries) returns ';
            echo isset($entries) ? 'true' : 'false' . '</div><br>';
            echo '<div class="serendipitySideBarDate">is_array($entries) returns ';
            echo is_array($entries) ? 'true' : 'false' . '</div><br>';
}
The 'else' part is added by me and it is executed, but not 'if' part. The output is:

Code: Select all

------
isset($entries) returns true
is_array($entries) returns false
$entries contains result of a serendipity_db_query($entries_query) function. Here is what contains $entries_query just before serendipity_db_query() call, when regular entries are shown and no filter is applied:

Code: Select all

SELECT id, title, timestamp FROM serendipity_entries WHERE isdraft = 'false' AND timestamp <= 1130324536 ORDER BY timestamp DESC LIMIT , 10
Now when filter IS applied:

Code: Select all

$entries_query is
SELECT id, title, timestamp FROM serendipity_entries WHERE isdraft = 'false' AND timestamp <= 1130326632 ORDER BY timestamp DESC LIMIT 12, 10
After 'DESC LIMIT there is a constant 12, that is not present in abowe query!!!
The value of $category after line 114

Code: Select all

$category       = $this->get_config('category', 'none');
is 'none' (I checked this with control echo operator) at the beginning of function generate_content(&$title), and may be here is the cause... because next lines

Code: Select all

        $sql_join   = '';
        $sql_where  = '';
        if ($category != 'none' && is_numeric($category)) {
            $sql_join = 'LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'entrycat AS ec ON id = ec.entryid
                         LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'category AS c  ON ec.categoryid = c.categoryid';
            $sql_where = ' AND (c.category_left BETWEEN ' . implode(' AND ', serendipity_fetchCategoryRange($category)) . ')';
        }
leave $sql_join and $sql_where empty.

BUT, when I applied the plugin_filter, the $category remained 'none' and the entries titles appeared.
Regards,

Ivan Cenov
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Thanks a lot for your debugging work! I found out that the fetchlimit is improperly set within the filter_entries plugin and just fixed that in version 1.1 of that plugin:

Code: Select all

                case 'frontend_fetchentries':
                    if ($this->fetchLimit > 0) {
                        $serendipity['fetchLimit'] = $this->fetchLimit;
                    }
                    break;
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