Guest
18 Jul 2017 23:31

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();
    }



}
?>

Last Modified: 27 May 2019


Sergey
Total posts: 13,748
12 Nov 2017 05:48

I do not remember which version exactly but in the version I upload right now 10.98 there is such a parameter in restricter plugin

2017-11-12_11-47-08


vnadmin
Total posts: 26
13 Nov 2017 04:03

I installed the correct version 10.98.

I tested but could not get the restictions to work correctly. If you go onto the site you do not get redirected to the Payment pages. I tried with various numbers and cleared the cache each time.

Here is my set up:

restricter_set_up


Guest
07 Dec 2017 23:55

Can I get some help on this item? I've been waiting a while.

Thanks.


Sergey
Total posts: 13,748
13 Dec 2017 13:23

Please note that if you test as super user it wil not work for you. You can see options above. But even if you turn them off it still may skip some restrictions for admin. test as simple registered user.


vnadmin
Total posts: 26
14 Dec 2017 20:20

Sergey,

I am testing this as an unregistered user. Please feel free to go on the site and test this. Soccer.virnative.com and browse around. You will be able to access all articles still.

Let me know,

Thx Darren


Sergey
Total posts: 13,748
21 Jan 2018 07:13

Give me full access in private comment.

Powered by Cobalt