I'm developing a content plugin to filter articles according to a field in CB profile.
Something like:
public function onContentPrepare ($context, &$article, &$params, $limitstart)
{
...code for CB setup...
Global $_CB_framework;
$CB=$_CB_framework;
$cbUser =& CBuser::getInstance( $myId );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
//Select the value choosen by the user in a specific field
$category = $cbUser->getField( 'cb_category' );
//Catch the category title
$cat=&$article->category_title;
//Put the user value in $esc
$esc= array ($category);
//If the value of the user choice correspond to the name of the category
if(in_array($cat, $esc) ) {
// Hide the entire article.
// Now what i do is hide title, text, hits and other properties of $article
unset($article->title);
unset($article->introtext);
unset($article->text);
unset($article->hits);
}
else
echo (' </br>Nothing to do</br>');
}
To hide all content I've tried to unset $article property like $article->text and it's work.
But...I need more...
I need to unset the entire $article object.
Unset or hide.
I've tried to change $article state property to state->0 (unpublished) but works like a simple label and the article was still displayed.
Any idea about it?
Thanks in advance!