Page 1 of 1
user-gallery: backlink to entries - link to drafts
Posted: Tue Dec 26, 2006 2:15 pm
by stm999999999
hello,
as I see there is a little bug:
on the image pages there is a list of entries using this picture. But it links to entries which are not published, too.
for the static pages it works well.
Re: user-gallery: backlink to entries - link to drafts
Posted: Thu Dec 28, 2006 8:16 pm
by garvinhicking
Hi!
The references are counted using visits to the image within an entry...so once it lands in the references-DB table, s9y cannot see if the entry is a drafted or undrafted one, without performing an performance-intense DB crossjoin.
However, in real world this shouldn't be a real problem because the drafts cannot be seen online?
Best regards,
Garvin
Posted: Thu Dec 28, 2006 8:31 pm
by stm999999999
Äh, what reference-table?
If I see it correct, the code is
Code: Select all
$q = "SELECT e.id, e.timestamp, e.title
FROM {$serendipity['dbPrefix']}entries AS e
WHERE (MATCH(e.title, e.body, e.extended) AGAINST ('" . serendipity_db_escape_string($big) . "')
OR MATCH(e.title, e.body, e.extended) AGAINST ('" . serendipity_db_escape_string($thumb) . "'))
AND (e.body REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")'
OR e.extended REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")')
ORDER BY e.timestamp DESC";
$e = serendipity_db_query($q, false, 'assoc');
Should it be not possible to make it like the static pages:
Code: Select all
$q = "SELECT s.*
FROM {$serendipity['dbPrefix']}staticpages AS s
WHERE (MATCH(headline,content) AGAINST('" . serendipity_db_escape_string($big) . "')
OR MATCH(headline,content) AGAINST('" . serendipity_db_escape_string($thumb) . "'))
AND (s.content REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")'
OR s.content REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")')
AND s.publishstatus = 1
AND s.pass = ''
GROUP BY s.id
ORDER BY s.timestamp DESC";
Posted: Thu Dec 28, 2006 8:38 pm
by garvinhicking
Hi!
From which file/line are you taking this code?
Best regards,
Garvin
Posted: Thu Dec 28, 2006 9:17 pm
by stm999999999
serendipity_event_usergallery.php
Line:1160 and 1214
Posted: Thu Dec 28, 2006 9:55 pm
by garvinhicking
Hi!
Argl. It seems I should pay attention to posting subject lines
Sorry for misreading you like that. I just committed a patch to version 2.23 of that plugin that should now take 'e.isdraft' into appreciation.
Best regards,
Garvin
Posted: Thu Dec 28, 2006 10:02 pm
by stm999999999
Thanks!