这是我的模块中使用的功能所以我用它来显示具有已发布状态和某些条件的文章。
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;
}
}
我想为它隐藏未发表的文章。但无法找到它所需的确切条件。所以请给你的建议。