TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: hidden69 on October 29, 2010, 09:54:10 PM

Title: Categories on Frontpage Bug&Fix
Post by: hidden69 on October 29, 2010, 09:54:10 PM
Hi,

if you have more then 1 categorylist in a block f.e. on the frontpage, then only the last one is shown. To fix this find in the TPortal.php

Code: [Select]
  // any cat listings from blocks?
    if(isset($test_catbox) && $fetchtitles!='')
{
$request =  tp_query("SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname,
IFNULL(mem.real_name,art.author) as realName FROM " . $tp_prefix . "articles AS art
LEFT JOIN " . $db_prefix . "members AS mem ON (art.author_id = mem.id_member)
WHERE " . $fetchtitles . "
AND art.off=0
AND ((art.pub_start=0 AND art.pub_end=0) OR (art.pub_start!=0 AND art.pub_start<".$context['tportal']['now']." AND art.pub_end=0) OR (art.pub_start=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now'].") OR (art.pub_start!=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now']." AND art.pub_start<".$context['tportal']['now']."))
AND art.approved=1", __FILE__, __LINE__);

$context['TPortal']['blockarticle_titles']=array();

and replace it with
Code: [Select]
  // any cat listings from blocks?
    if(isset($test_catbox) && $fetchtitles!='')
{
$request =  tp_query("SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname,
IFNULL(mem.real_name,art.author) as realName FROM " . $tp_prefix . "articles AS art
LEFT JOIN " . $db_prefix . "members AS mem ON (art.author_id = mem.id_member)
WHERE " . $fetchtitles . "
AND art.off=0
AND ((art.pub_start=0 AND art.pub_end=0) OR (art.pub_start!=0 AND art.pub_start<".$context['tportal']['now']." AND art.pub_end=0) OR (art.pub_start=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now'].") OR (art.pub_start!=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now']." AND art.pub_start<".$context['tportal']['now']."))
AND art.approved=1", __FILE__, __LINE__);

if (!$context['TPortal']['blockarticle_titles']){
$context['TPortal']['blockarticle_titles']=array();
}

another fix, where the realname of the author isnt shown on the frontpage, is fixed by

find this in the TPortal.php
Code: [Select]
    if(isset($test_catbox) && $fetchtitles!='')
{
$request =  tp_query("SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname,
IFNULL(mem.real_name,art.author) as real_name FROM " . $tp_prefix . "articles AS art
LEFT JOIN " . $db_prefix . "members AS mem ON (art.author_id = mem.id_member)
WHERE " . $fetchtitles . "
AND ((art.pub_start=0 AND art.pub_end=0) OR (art.pub_start!=0 AND art.pub_start<".$context['tportal']['now']." AND art.pub_end=0) OR (art.pub_start=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now'].") OR (art.pub_start!=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now']." AND art.pub_start<".$context['tportal']['now']."))
AND art.off=0
AND art.category>0
AND art.approved=1", __FILE__, __LINE__);

and replace it with
Code: [Select]
    if(isset($test_catbox) && $fetchtitles!='')
{
$request =  tp_query("SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname,
IFNULL(mem.real_name,art.author) as realName FROM " . $tp_prefix . "articles AS art
LEFT JOIN " . $db_prefix . "members AS mem ON (art.author_id = mem.id_member)
WHERE " . $fetchtitles . "
AND ((art.pub_start=0 AND art.pub_end=0) OR (art.pub_start!=0 AND art.pub_start<".$context['tportal']['now']." AND art.pub_end=0) OR (art.pub_start=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now'].") OR (art.pub_start!=0 AND art.pub_end!=0 AND art.pub_end>".$context['tportal']['now']." AND art.pub_start<".$context['tportal']['now']."))
AND art.off=0
AND art.category>0
AND art.approved=1", __FILE__, __LINE__);

Annotation:
Maybe the "Display Author" setting from the respective article should be used, to print or not print the author (as this can be a valid feature request).

regards
Title: Re: Categories on Frontpage Bug&Fix
Post by: Nolt on June 15, 2011, 04:38:33 AM
Not working, still on my frontpage news are from only one category (I have selected 3 of them) ;/
Title: Re: Categories on Frontpage Bug&Fix
Post by: IchBin on June 15, 2011, 11:52:42 AM
I've added in the fix above. Nolt, are you referring to front page news? This is for the category blocks.
Title: Re: Categories on Frontpage Bug&Fix
Post by: Nolt on June 16, 2011, 01:24:48 AM
Yest, I was talking about page news. Sorry for reply on wrong topic.