I had a massive update from PHP5.6 to PHP7.1 and and server components. Plus Joomla to latest version. Please if something does not work report on forum.

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


vnadmin
Total posts: 26
25 Jul 2017 04:27

hi!

Can we get somw help on this item. It is causing serious issues in the release time of a site that uses Emerlad 10.

Thanks Darren


Sergey
Total posts: 13,645
26 Jul 2017 04:40

You do not need this plugin. Use restriction in the plan and restrict articles. Emerald will show those articles only to users who has subscritpion.


Guest
30 Jul 2017 03:12

Sergey,

Thanks for the reply. The plugin allows the user to view a set number of full articles (i.e. 2-3 for free) then redirect them to a membership page. So it is not the same functionality as restricting all articles until they pay unfortuntely. The plugin also allows googlebot to crawl these pages fully and is very important for SEO.

Is the plugin currently pointing to the wrong file?

Thanks, Darren


Guest
31 Jul 2017 22:18

Is this section maybe updated now in Emerald 10 to a new file name?

$sql = "SELECT COUNT(*) FROM #__jcs_user_subscr WHERE user_id = '".$user->id."' AND ctime <= '$date' AND extime >= '$date' AND published = 1";


vnadmin
Total posts: 26
01 Aug 2017 15:50

Please can I get some help on this, it is causing very serious issues to our business and we are a customer of yours since Emerald 8, is there another way to get support, or is here the correct place.


Sergey
Total posts: 13,645
10 Aug 2017 11:30

Tell me what restriction rule you are using? Com_content?


vnadmin
Total posts: 26
10 Aug 2017 22:54

Yes, I believe so. See the code snippet above. if($view=='article' && $option=='com_content' && @!in_array($id,$articles)){

Basically we have a plugin that allows the user to see 3 articles for free then redirects them to payment screen for Emerald. This is in order to repspect the 'Google First Click Free' policy. Refer to https://support.google.com/news/publisher/answer/40543?visit_id=1-636380009182674024-1181025107& ;rd=1 for more details.

Problem is that since we upgraded to Emerald 10 the old user subscriptions are expiring and if I reset them 're-publish' them in Emerlad 10 the plugin is not allowing them to see all the articles. I have migrated the old Emerald accounts to the new site.

So it seems that the plugin is checking the wrong place to see if there is an active subscription or not. That is my assumption at this point. Publish active subscriptions in Emerald 10 are not allowed to see unlimited articles because the plugin doesnt recognize the subscription adn blocks access.

If you need access to the plugin code (beyond what is above on this post), let me know.

Thanks,


Sergey
Total posts: 13,645
22 Aug 2017 11:39

This plugin is based on sessions. It means that if youse logout and the login back he again have 3 articles access.

This plugin does not work because it is triggered after restriction was checked. In order to make this feature work, we have to add it to com_content restriction rule components/com_emerald/library/rules/com_content/com_content.php.


vnadmin
Total posts: 26
15 Sep 2017 21:18

Thanks Sergey,

Can you make that addition if I provide access details, etc? Or provide exact instructions on what to add to each line in that file?

Thx Darren


Sergey
Total posts: 13,645
21 Sep 2017 14:27

I can do that as custom development. It is quite a work. DB table have to be created to trak number of free articles per subscription. And then there are questions.

  1. After you access your 3 articles for free, you cannot access other areticles but can you still access those those 3?
  2. After you subscribed to new subscription do you get access to fist 3 articles you open of first 3 unique articles? I mean if user open as first 3 articles one of articles user opened as first 3 articles with first subscription?

And some other questions like that.


vnadmin
Total posts: 26
26 Sep 2017 01:26

Sergey,

Thanks. Can you give me an estimate on what it would cost here?

1) After you access your 3 articles for free, you cannot access other areticles but can you still access those those 3? Whatever is easiest.

As long as after attempting 'x' number of articles. The user is redirected to the payment page.

2) After you subscribed to new subscription do you get access to fist 3 articles you open of first 3 unique articles? I mean if user open as first 3 articles one of articles user opened as first 3 articles with first subscription?

After subscription the user can view all articles on the website (as long as they have an active subscription).

I attempted to attach the updated specification so you can view:

37 PM


Sergey
Total posts: 13,645
26 Sep 2017 13:30

Ok, after reading this I can see that user have to get first 3 articles access before subscription and asked for subscription.

I am sorry I completely lost this one. I thought that user have to get first 3 after subscription but that make no sense, if user already have a subscription.

I see.

I think this task might be comleted simplier. I can add parameter to restricter plugin next update free.


vnadmin
Total posts: 26
04 Oct 2017 19:19

Sounds good Sergey. Do you know when you would be able to release the update to the plugin?
Ideally I have my users redirected to a specific page, that has link buttons for emerald payment options.

So the main requirements I would suggest that are present in the currect plugin that are useful to users: 1) Redirect user after 'x' number of free article views. (i.e. 2,3 views etc) 2) Article field to not include in this rule. I.E. Articles that are always viewable and dont redirect (Done by article ID) (I.e. 507, 197, etc)! 3) Choose the page to redirect to.

I can help with anything needed and testing etc. Let me know.

Thanks You! Darren

Screen shot of the options for the original plugin: [38 PM]( https://adwsfiles.s3.amazonaws.com/test/2017-10/1507144705_Screen Shot 2017-10-04 at 12.17.38 PM.png)


vnadmin
Total posts: 26
13 Oct 2017 17:56

Sergey et al,

Could you let me know an estimated timeline so I can plan. I have a web business on hold currently. If its in the next few weeks I can hold off, otherwise I may have to go another route.

Thx Darren


Sergey
Total posts: 13,645
15 Oct 2017 12:16

I have already implemented it. I'll update this week.

When you post pictures make sure there are no white spaces in the name.

vnadmin So the main requirements I would suggest that are present in the currect plugin that are useful to users: 1) Redirect user after 'x' number of free article views. (i.e. 2,3 views etc) 2) Article field to not include in this rule. I.E. Articles that are always viewable and dont redirect (Done by article ID) (I.e. 507, 197, etc)! 3) Choose the page to redirect to.

It will work not with articles but with restrictions. You can restrict other things but anyway you can set how many times user can use it for free before redirected to subscription.

There will be no parameter for redirection. The normal Emerald subscription flow will be in place after N amount of free times.


vnadmin
Total posts: 26
21 Oct 2017 16:34

Sergey,

I will be happy to test this when implemented. Have you been able to update this yet? Im assuming it will be in an update to 'Core Joomla Articles (com_content)'?

Let me know and I will test and let you know the results.

Thank You,

Darren


Sergey
Total posts: 13,645
23 Oct 2017 14:34

I'll post updated Emerald today. There is a parameter in restrictor plugin.


vnadmin
Total posts: 26
25 Oct 2017 18:23

What is the easiest way for me to update the 'Emerald - Restricter' plugin? Is there a place to download the new updated version only?

Thanks, Darren


Guest
02 Nov 2017 21:28

Sergey,

Do I need to unistall and re-install to Emerald 10 to see these change to the restrictor plugin? Or is there a way to just update the restrictor plugin?

Let me know, Thanks, Darren


vnadmin
Total posts: 26
11 Nov 2017 02:12

Sergey,

I updated my instalation with the following package: pkg_emerald.j3.v.10.97.zip

But I cannot see where the restriction rules of where to enter the number of times the article can be viewed prior to the redirect to the regular payment flow. Please can you help to point out where it is?

Thx Darren

Replay Topic
Uploading
Click here to upload and insert file from you hard drive: (png, gif, jpg, jpeg, zip, txt, rar)
Powered by Cobalt