Restrict download buttons

12 years 2 months ago #190458 by reders
Restrict download buttons was created by reders
Hi,

I'm not sure how we can achieve this, i am using
Joomla 1.7
CB 1.7.1
CBSubs 1.2.2
K2 2.5.0

The content on the site is managed using K2 so i cannot restrict access to the content using the cb subs content plugin, i know we can restrict access based on URL but this wont achieve what we need.

What we are trying to do is allow users to access all of the content on the site but not allow access to the download buttons on the K2 items.

A link to a K2 item page is:
www.s387718370.websitehome.co.uk/Proofs/ArtTactic/index.php?option=com_k2&view=item&id=35:sample-report&Itemid=103

Can i show or hide the download button dependent on the subscription level.

Thanks
Sean.R

Please Log in to join the conversation.

12 years 2 months ago - 12 years 2 months ago #190506 by krileon
Replied by krileon on topic Re: Restrict download buttons
Using By URL Part protection protect the below and it should block download links.

option=com_k2&view=item&task=download


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 to join the conversation.

12 years 2 months ago #190580 by reders
Replied by reders on topic Re: Restrict download buttons
Hi, thanks for the quick response.

This is a solution to block unregistered users from downloading reports however the subscriptions work in this way,

Lite subscription - access to 1 art market, selected via a drop down on the registration form
Regular subscription - access to 2 art markets, selected via 2 drop downs on the registration form
Plus + subscription - access to 3 art markets, selected via 3 drop downs on the registration form
Premium subscription - access to all art markets

*on the website - if you hover over Market Analysis on the main menu you can see the list of art markets (Africa, Brazil, China etc ... )

I have used the hide fields at registration function to hide the drop downs if not required for this subscription, for example on the lite subscription you would only see one drop down.

Each art market is a K2 category.

I think i need a statement that knows which art market/art markets a user has selected and the ID of the corresponding K2 category so they can have access to the reports, but then to block the report downloads on the art markets they do not have access to.

I presume that cbsubs will not do this out of the box, but any pointers to how to achive this will be much appreciated.

Hope this makes sense

Regards
Sean.R

Please Log in to join the conversation.

12 years 2 months ago #190601 by krileon
Replied by krileon on topic Re: Restrict download buttons
You can't do that (limit number of downloads) unless K2 has a built in feature to limit number of downloads or article views on a user by user basis that you can manipulate with CBSubs. CBSubs can't add features to an extension that don't exist in that extension.


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 to join the conversation.

12 years 2 months ago #190622 by reders
Replied by reders on topic Re: Restrict download buttons
Hi Krileon,
Sorry I think you have misunderstood my questions.

We are not trying to limit the number of downloads based on subscription.

All we want to do is hide the download button based on what subscription the user is on.

The button is currently displayed using this code:
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments)): ?>
       <!-- Item attachments -->
            <div class="itemAttachmentsBlock">
          		<ul class="itemAttachments">
            		<?php foreach ($this->item->attachments as $attachment): ?>
            		<li>
                		<a class="downloadreport" title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo $attachment->link; ?>">
                    	Download Report
                		</a>
                	<?php if($this->item->params->get('itemAttachmentsCounter')): ?>
                		<span><?php echo $attachment->hits; ?> <?php echo (count($attachment->hits)==1) ? JText::_('K2_DOWNLOAD') : JText::_('K2_DOWNLOADS'); ?></span>
                	<?php endif; ?>
            		</li>
            		<?php endforeach; ?>
          			</ul>
      		</div>
            <?php endif; ?>

We are hoping that we can wrap this code in a php if/else statement and it will hide the button based on the subscription id or something?


We do want further control of this further on the project, but if we can get this working first that would be brilliant.

Regards,
Sean R.

Please Log in to join the conversation.

12 years 2 months ago #190628 by krileon
Replied by krileon on topic Re: Restrict download buttons
It doesn't look like it's user by user based. So I don't think you'll be able to show/hide the download button on a user by user basis. It seams to only be controlled on a article by article basis. The URL provided in By URL Part will protect the download link, but it won't show/hide it based off subscription.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.274 seconds

Facebook Twitter LinkedIn