I currently have a problem with an ajax call in my new module. the filters are not used. Here is an extract of the relevant lines:
$articleid = $data_decoded->articleid; // Get an instance of the generic articles model require_once(JPATH_ADMINISTRATOR . '/components/com_content/models/articles.php'); $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); $model->setState('filter.article_id', $articleid); return $model->getItems();
$articleid contains the searched article ID as an integer.
The function returns the complete list of existing articles.
The goal is to receive the searched article and / but filter also to check for access restrictions & published state...
Added: If i am using the Article Model like used below, i can also not filter is that correct? (it returns an empty article object)
require_once(JPATH_ADMINISTRATOR . '/components/com_content/models/article.php'); $model = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true)); $model->setState('filter.article_id', 22); return $model->getItem();
I'm sure it's just a stupid mistake or i misunderstood something, but I just don't see...
Thanks for your feedback