News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Mirror Downloads only for Registered users

Started by mkhde, 06.07.2016 10:31:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mkhde

Hey Arno

Is it possible to add in future the option to limit mirror downloads only to registered users or for a special usergroup?

Would be nice  :)
  •  

mkhde

#1
I added it by myself with

$user = JFactory::getUser();
if($user->id > 0) {
$mirror1_link = '<a '.$blank_window1.' href="'.$mirror1_link_dum.'" class="jdbutton '.$download_color_mirror1.' '.$download_size_mirror.'">'.JText::_('COM_JDOWNLOADS_FRONTEND_MIRROR_URL_TITLE_1').'</a>';
it works for me
  •  

ColinM

Hi
Good idea

To implement as something general we would also need to add to the Config - FrontEnd Tab something like "Only show Mirror links if Logged On".
Also which php file did you edit? It may need editing in more than one file.

And did you make it an override?

Colin
Colin M
  •  

Arno

It is also now possible to do it with the 'hide' functionality from the jD system plugin and a few placeholders in the layout.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

ColinM

@mkhde
Just to expand and illustrate the point made by Arno note that the Mirror links are shown by the layout placeholders {mirror_1} and {mirror_2} respectively.

If one looks at the Advanced section of the jDownloads System plugin it is seen that it supports 'hide' functionality plugins such as {jdreg}.
That is if some text is contained within {jdreg} to its closing {/jdreg} then it will only be seen by any processing code if the user belongs to the registered user group or any user group that has the Registered UG as one of its forefathers. This would include Author, Editor and Publisher UGs and any other UG that has the Registered UG as its parent, or grandparent and so on.

So if for example the layout contained  something such as below
<div class=jd_mirror>click on {mirror_1} to download from Mirror 1.</div>
then everyone would see the message and the mirror action button.
But if it is modified to say
<div class=jd_mirror>{jdreg}click on {mirror_1} to download from Mirror 1.{/jdreg}</div>
then only logged on users, that is those with a forefather in the Registered UG, would see the message and the action button.

Colin
Colin M
  •