Hiding Information from Selected User Classes

Sometimes situations arrive where one needs to show content to some users but not to others. Perhaps say Public users might see different text to that shown to logged in users.  Maybe different User Groups need to see different information.

To achieve these possibilities you can use the 'hide' functionality plugins supported by jDownloads. When this is activated it is possible to show information on a selective basis.

This use is not restricted to just jDownloads content (Descriptions, Titles, Layouts and so on) but may also be used in Joomla! Article and Module content.

First let us give a simple example.  If you use the files layout "Files Layout with Readmore and download Buttons v3.2" then it will show you a Read More button as ilustrated below

Hide01
 

Clicking on the Read More button takes one to the Download Details view.  But suppose we only want to show that level of information to users who are logged in. There is no configuration parameter available to control that situation.  The answer is to enable the Hide Functionality in the jD System plugin.

In this example we are going to use the hide facility within a jD layout; however the functionality, as mentioned earlier, is much, much wider.  To repeat, It can be used in all jDownloads output elements (Descriptions, Titles, Layouts and so on) and also in standard Joomla! Modules and Article content.  That is the hide functionality is not limited to jD items but is universal.-they are a set of regular plugins supported by the JDownloads System plugin.

In this example we will be editing a layout. If you are unsure of how to do this then you may find the following articles useful:

http://www.jdownloads.net/documentations/item/layouts-overview

http://www.jdownloads.net/documentations/item/editing-a-layout

 

The files layout "Files Layout with Readmore and download Buttons v3.2" has the following code fragment at the bottom of the main part of the layout:

<!-- now the details -->
<divclass="jd_clear">{tags}</div>
<div class ="jd_content_wrapper {featured_detail_class}" style="">   
   <div class="jd_clear"> </div>
   <div class="jd_readmore">{link_to_details}</div>
</div>
<div class="jd_clear"></div>

Obviously the line which generates the readmore button is   <div class="jd_readmore">{link_to_details}</div>

So we edit a copy of the layout to be {jreg}<div class="jd_readmore">{link_to_details}</div>{/jreg}

For a non logged in ' public' user the view is now:

Hide02

 

 

 

 

 

And a logged in user sees as below 

Hide03

The above simple example shows a little of the potwential functionality of the hide feature.

The full list of 'hide' plugins are noted below

This text will only be seen visitors who are NOT logged-in
This text will only be seen by logged-in users
Only members of the Author user group will see this
Only Editors see this
Only Publishers see this
Only Managers see this
Only Admins see this
Only Super Users see this
All members from the Special User Group will see this
{jduser:id} Only the member with the given ID can see this {/jduser}
{jdgroups:name} Only members from the given user group can see this {/jdgroups}

  NB Note that Joomla! User Groups support inheritance so those who can see includes the parent User Group, the grand parent User Group and so on. This could include the Public UG.

You can use it in ALL jDownloads output elements (Descriptions, Titles, Layouts etc.) and also in Modules and Article content.

Activating the Hide Functionality

In Extensions - Plugins Manager find the plugin 'System - jDownloads'

After entering the plugin, select the Advanced tab

At the bottom of the page ensure you set to Yes

The save and exit as normal. All is now functional.

Hide04

 

 

 

 

If you have used this option and deactivate it at a later date by setting to No, all previously hidden elements will become visible for ALL users. The inserted plugins will not be seen whilst this plugin remains published.

 

Colin Mercer, 27th April 2018

  • Freitag, 27 April 2018