Page 2 of 2
Re: Recent Entries Sidebar
Posted: Sat Mar 13, 2010 1:08 am
by diroddi
Hi -
Yes the SQL also shows. Have you visited the URL?
Re: Recent Entries Sidebar
Posted: Sat Mar 13, 2010 9:46 am
by garvinhicking
Hi!
Ah, I think I got the SQL error. Please check out this file:
http://svn.berlios.de/viewcvs/*checkout ... ntries.php
Best regards,
Garv in
Re: Recent Entries Sidebar
Posted: Sat Mar 13, 2010 4:17 pm
by diroddi
Hi
I've updated the plugin with your file in cvs.
Plugin-1 works on the overview page. No luck on Plugin-2, neither on a specific entry or a category.
Unknown column 'c.categoryid' in 'on clause'
Looks like it's a problem with this join, but I dont see where it's being set: LEFT JOIN serendipity_access AS acl_acc ON (acl_acc.artifact_mode = 'read' AND acl_acc.artifact_type = 'category' AND acl_acc.artifact_id = c.categoryid)
Re: Recent Entries Sidebar
Posted: Sat Mar 13, 2010 9:21 pm
by garvinhicking
Hi!
The problem is that some other plugin on your isntall is also modifying the SQL query (most probably the entryproperties plugin) so it's hard for me to debug; I'm trying to blindly fix your specific problem without being able to properly reproduce it here.
The error happens because the 'category' column is referenced before it's joined. This happens due to my earlier bugfix, which did fix the one issue, but opened up another. Can of worms, I tell you.
I just updated the plugin again (same download link) so maybe you still have the patience to try that one out? I'm really sorry for it taking so long, but I hope you can understand that due to me missing a test-setup where I could easily reproduce the issue
Best regards,
Garvin
Re: Recent Entries Sidebar
Posted: Sun Mar 14, 2010 4:57 pm
by diroddi
Hi -
I have plenty of patience, and was hoping that you didn't lose yours. I appreciate your help and time in making this work.
I've updated the plugin.
Plugin1 works as expected on the overview page and plugin2 works as expected when viewing an entry. Thanks again!
The only piece missing is limiting entries to the specific category a user is viewing. I'm not even sure it's possible, using 2 plugins or not. Plugin1 is set to 'all' on the 'overview page' and plugin2 is set to 'parent' on 'extended'. I'm sure viewing a category is considered 'overview' because of multiple entries being shown and and is why plugin1 and 'all' are displayed.
I can live with that, but still think it would be better the other way.
Re: Recent Entries Sidebar
Posted: Mon Mar 15, 2010 9:29 am
by garvinhicking
Hi!
Great that at least the error is gone.
Having plugin2 set to "Parent" is what should actually do the trick.
Maybe you can edit the plugin file and replace this code at line 140:
Code: Select all
if ($category == '_cur') {
$category = $serendipity['GET']['category'];
if (empty($category) && !empty($serendipity['GET']['id'])) {
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id']);
$category = $entry['categories'][0]['categoryid'];
}
}
with this:
Code: Select all
if ($category == '_cur') {
echo "Parent category elected.<br />\n";
$category = $serendipity['GET']['category'];
echo "Catid: $category<br />\n";
if (empty($category) && !empty($serendipity['GET']['id'])) {
echo "Checking entry #" . $serendipity['GET']['id'] . "<br />\n";
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id']);
$category = $entry['categories'][0]['categoryid'];
echo "Catid: $category<br />\n";
print_r($entry);
} else {
echo "No data (1)<br />\n";
}
} else {
echo "No data (2)<br />\n";
}
And then see what the plugin will output to us. I'm guessing that somehow the variable for the entryid might not be set, or the return array is missing data.
Regards,
GArvin
Re: Recent Entries Sidebar
Posted: Mon Mar 15, 2010 4:06 pm
by diroddi
Hi -
I've made the change.
When I say 'limiting entries to the specific category a user is viewing', I mean the specific category the user clicked on the sidebar. I figured this would be considered an 'overview' page because there is multiple entries displayed for the chosen category, and is why Plugin1 is being shown.
Re: Recent Entries Sidebar
Posted: Tue Mar 16, 2010 9:51 am
by garvinhicking
Hi!
Ah, what I believe the problem is, is that plugin1 is set to "all categories", so when it is displayed on overview pages (which is "all but an entry detail page") it shows entries of all categories. To fix that, I think you can simply remove plugin1, and set plugin2 to "All pages". Then it catches a category ID, if selected (either due to category overview or due to a single entry), and if no category ID is available, it should fall back to displaying entries of all categories.
HTH,
Garvin
Re: Recent Entries Sidebar
Posted: Wed Mar 17, 2010 4:07 pm
by diroddi
It works perfect! I like using 1 plugin rather than 2 and think it makes for a cleaner solution.
Once again thank you for your time and effort in getting this working. I hope that others will like the new functionality as well.
Cheers!
Re: Recent Entries Sidebar
Posted: Wed Mar 17, 2010 6:59 pm
by garvinhicking
Hi!
No problem, you're welcome. I'm glad you staid aboard during this painful step-by-step improvement.
Regards,
Garvin