We got this working with the sessions in the db
Just a few lines of code and its done. You might want to consider rolling this into the CBSubs Content plugin as a new feature. Have a text box somewhere where a number can be typed to set a variable and people can then provide x or xxxx number of free previews!!
The file we modified is cbsubs.content_access.php
I'm pasting the code here for you guys to use as you see fit. You might want to mark this topic solved
Code:
function cbpaidsubsbot_onBeforeDisplayContent( &$row, &$articleParams, $page ) {
global $_CB_framework;
//multicats override
$m_id = JRequest::getVar('id');
$m_view = JRequest::getVar('view');
// ====================== Prakash for 3 free articles =================================== //
$m_option= JRequest::getVar('option');
$user = JFactory::getUser();
if(count($_SESSION['free_article_id']) > 0){
$myarraty = $_SESSION['free_article_id'];
}else{
$myarraty = array();
}
if($m_option == 'com_content' && $m_view == 'article' && isset($m_id)){
if(!in_array($m_id,$myarraty) && count($myarraty) < 3){
$myarraty[] = $m_id;
$_SESSION['free_article_id'] = $myarraty;
}
if(in_array($m_id,$_SESSION['free_article_id'])){
return;
}else if(!$user->id){
$app = &JFactory::getApplication();
$app->redirect( cbSef( 'index.php?option=com_comprofiler&task=registers&Itemid=472' ));
}
}
// ====================== End Prakash =================================== //
if($m_view == 'category') { $row->catid = $m_id; }