Skip to Content Skip to Menu

[SOLVED] View xx number of articles before CBSubs restricts the view

  • WebJIVE
  • WebJIVE
  • OFFLINE
  • Posts: 122
  • Thanks: 10
  • Karma: 4
10 years 4 months ago - 10 years 3 months ago #239071 by WebJIVE
I have a client where we have used CB and CBSubs to build a large subscription site. Here's what my client wants to do is have have so that users can view say 3 articles before redirecting you to a page to login or register.

Would this be possible with CB and CBSubs?

Eric Caldwell
Web-JIVE.com
Last edit: 10 years 3 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 68605
  • Thanks: 9108
  • Karma: 1434
10 years 4 months ago #239089 by krileon
No, CB and CBSubs do not have a view limit feature like that. The access is absolute. You either have access or you don't. You'd need to develop something to provide a 3 view limit.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • WebJIVE
  • WebJIVE
  • OFFLINE
  • Posts: 122
  • Thanks: 10
  • Karma: 4
10 years 4 months ago #239095 by WebJIVE
Thanks. Would it be advisable to make a copy of the Content plugin and modify it to allow for X number of "free views" based on a cookie? We would also need to display a popup if cookies are disabled at the client PC.

Also, would you guys be available to handle a mod like this for us?

Thanks!

Eric Caldwell
Web-JIVE.com

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 68605
  • Thanks: 9108
  • Karma: 1434
10 years 4 months ago #239101 by krileon
You wouldn't want cookie based as that's insanely easy to edit and fake. You'll need a database to store who viewed what and on 3 views begin protecting. A modified version of CBSubs Content should be able to do this. You'll basically ignore the plan protection until view limit hits 3.

Also, would you guys be available to handle a mod like this for us?

No, we do not do contract development.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • WebJIVE
  • WebJIVE
  • OFFLINE
  • Posts: 122
  • Thanks: 10
  • Karma: 4
10 years 3 months ago - 10 years 3 months ago #240334 by WebJIVE
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; }

Eric Caldwell
Web-JIVE.com
Last edit: 10 years 3 months ago by WebJIVE.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum

Facebook Twitter LinkedIn