This are functions used in my module So am using it for displaying the articles with published state and with certain conditions.
class modArtbyauthorHelper
{
function loadCbDetails(&$params)
{
$topid = JRequest::getInt('id');
$db = JFactory :: getDBO();
$query = "SELECT firstname, user_id, lastname, avatar, cb_category, cb_informationnew FROM #__comprofiler WHERE cb_category = ".$topid;
$db->setQuery($query);
$result = $db->loadObjectList();
return $result;
}
function loadArticles(&$params)
{
$helper = new modArtbyauthorHelper();
$result = $helper->loadCbDetails($params);
$cb_userid = $result[0]->user_id;
$catid = $result[0]->cb_category;
$limit = $params->get('limit');
$db = JFactory :: getDBO();
$query = "SELECT title, id FROM #__content WHERE state=1 AND created_by = ".$cb_userid." AND catid <> ".$catid." ORDER BY created DESC LIMIT ".$limit;
$db->setQuery($query);
$result = $db->loadObjectList();
return $result;
}
}
I Want to hide unpublished articles for it. But Not Able to find the exact condition required for it. So plz give your suggestions.