Hi,
I am a Emerald 10 user (recently upgraded from Emerald 8) and I am having an issue with a plugin that used to work directly with Emerald 8. It is very important for my site and its functionality. The plugin checks against the emerald user file and displays an article depending on if the user has an active subscription though Emerald or not. Has this file changed from Emerald 8 to Emerald 10?
Heres the selection code (full code below):
$sql = "SELECT COUNT(*) FROM #__jcs_user_subscr WHERE user_id = '".$user->id."' AND ctime <= '$date' AND extime >= '$date' AND published = 1";
Is this file location/name different now?
Thanks,
Darren
Full php code of plugin:
<?php
/**
* Plugin: EZ Realty Header Tags
* FileName: freecontentaccess.php
* Date: 20th November 2013
* License: Creative Commons GNU GPL, see http://creativecommons.org/licenses/GPL/2.0/ for full license
* Script Version #: 1.0.0
* Author: K.J. Strickland - http://www.joomlageeks.com
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.event.plugin');
class plgSystemfreecontentaccess extends JPlugin
{
function plgSystemfreecontentaccess( &$subject, $config )
{
parent::__construct($subject, $config);
}
function onAfterDispatch()
{
$mainframe = JFactory::getApplication();
$session = JFactory::getSession();
$uri = JRequest::getURI();
$db = JFactory::getDBO();
if(strpos('J'. $uri, 'administrator/')) return;
$plugin = JPluginHelper::getPlugin('system', 'plgSystemfreecontentaccess');
$mosConfig_live_site = JURI::root();
$user = JFactory::getUser();
$articles = $this->params->get( 'articles', 0 );
$counts = $this->params->get( 'counts', 5 );
$articles = @explode(",",$articles);
$id = JRequest::getInt('id');
$view = JRequest::getVar('view');
$option = JRequest::getVar('option');
if($view=='article' && $option=='com_content' && @!in_array($id,$articles)){
$subscription = $this->checkSubscription();
if(!$user->id || !$subscription){
$countarticles = $session->get('countarticles',1);
if($countarticles>$counts){
$mainframe->redirect( JRoute::_( 'main-pages/membership' ));
return;
}
$countarticles++;
$session->set('countarticles',$countarticles);
}
}
return;
}
function checkSubscription(){
$db = JFactory::getDBO();
$user = JFactory::getUser();
$date = date("Y-m-d H:i:s");
$sql = "SELECT COUNT(*) FROM #__jcs_user_subscr WHERE user_id = '".$user->id."' AND ctime <= '$date' AND extime >= '$date' AND published = 1";
$db->setQuery($sql);
return $db->loadResult();
}
}
?>
Hi,
I am a Emerald 10 user (recently upgraded from Emerald 8) and I am having an issue with a plugin that used to work directly with Emerald 8. It is very important for my site and its functionality. The plugin checks against the emerald user file and displays an article depending on if the user has an active subscription though Emerald or not. Has this file changed from Emerald 8 to Emerald 10? Heres the selection code (full code below):
Is this file location/name different now?
Thanks, Darren
Full php code of plugin: