Sign in to follow this  
Followers 0
ionut

how to hide unpublished article?

8 posts in this topic

How can I make the module to not display items that have not yet been bublished?

Because I have a category that is automatically publish one article every day.

Cuz now, the module displays all items in that category, even if they were not published.

How can i fix that?

TNX.

Share this post


Link to post
Share on other sites

version 1.2, and yes, the module display UNPUBLISHED articles in PUBLISHED category! (i use k2).

I found in /class/k2.php on line 283, wher select what to display from k2. I try to add somtinc like:

(start from line 288)


$query .= " WHERE a.published = 1"
. " AND a.access >= {$aid}"
. " AND a.trash = 0"
. " AND a.publish_up <= today's date"
(...)

But i'm not shore if it ok, can you help me?

Share this post


Link to post
Share on other sites

Current code in k2.php v1.3

$query .= " WHERE a.published = 1"
. " AND a.access IN(".implode(',', $user->authorisedLevels()).")"
. " AND a.trash = 0"
. " AND c.published = 1"
. " AND c.access IN(".implode(',', $user->authorisedLevels()).")"
. " AND c.trash = 0 " ;
$query .= " AND ( a.publish_up = ".$db->Quote($nullDate)." OR a.publish_up Quote($now)." )";
$query .= " AND ( a.publish_down = ".$db->Quote($nullDate)." OR a.publish_down >= ".$db->Quote($now)." )";

a -> articles table

c -> categories table

I thing that is correct to display! Please try to update BT content slider V 1.3 first!

ionut likes this

Share this post


Link to post
Share on other sites

For joomla 1.7 V 1.3 does not exist , only for joomla 1.5 .

I solved the problem like this:

Original code:

require_once ( JPath::clean(JPATH_SITE.'/components/com_k2/helpers/route.php') );
require_once ( JPath::clean(JPATH_SITE.'/components/com_k2/helpers/utilities.php') );

$query = "SELECT a.*, c.name as category_title,
c.id as categoryid, c.alias as categoryalias, c.params as categoryparams".
" FROM #__k2_items as a".
" LEFT JOIN #__k2_categories c ON c.id = a.catid" ;

$query .= " WHERE a.published = 1"
. " AND a.access >= {$aid}"
. " AND a.trash = 0"
. " AND c.published = 1"
. " AND c.access >= {$aid}"
. " AND c.trash = 0 " ;

EDITED :

require_once ( JPath::clean(JPATH_SITE.'/components/com_k2/helpers/route.php') );
require_once ( JPath::clean(JPATH_SITE.'/components/com_k2/helpers/utilities.php') );

(date_default_timezone_set("Europe/Bucharest"));
$azi=date("y-m-d H:i:s", time());

$query = "SELECT a.*, c.name as category_title,
c.id as categoryid, c.alias as categoryalias, c.params as categoryparams".
" FROM #__k2_items as a".
" LEFT JOIN #__k2_categories c ON c.id = a.catid" ;

$query .= " WHERE a.published = 1"
. " AND a.access >= {$aid}"
. " AND a.trash = 0"
. " AND a.publish_up <= '".$azi."'"
. " AND c.published = 1"
. " AND c.access >= {$aid}"
. " AND c.trash = 0 " ;

Share this post


Link to post
Share on other sites

This issue is also plaguing us. We are on Joomla 2.5.4 and everything up to date. I found a fix on it before but it's started happening again.

How can we fix this? Thanks!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0