Only show K2 intro text to unregistered users

One of the features that K2 chose not to bring over from Joomla articles is the concept of “Show Unauthorised Links”.  In Joomla, this simple checkbox allows you to display to all your visitors the link and intro of articles that have an access-level of “Registered”.  Once users click on the link, then they get prompted to login to view the full article.  That is a pretty common workflow for sites that use a paywall or register wall… So how do we accomplish this in K2?

There are some coding based solutions out there that involve adding some detection code around the full article display, you can find one of them here.

What I’m more interested, is a simple way to do it and the answer is Dioscouri’s Hider.

BE AWARE

If you are using the RSS feed option set to “Show the whole article” or print to PDF functionality then this solution is not going to work for you because it uses a plug-in and that does not get parsed by these 2 functions.

How to do it

So first, download and install Dioscouri’s free Hider plugin

Once the plugin is installed and enabled then you can use the following:

{pub} Any content (even HTML) contained within these will be public {/pub}

{reg} Any content here will be the content displayed only to visitors who are actually logged in {/reg}

One of the advantages of this even over the Joomla default behavior is that the {pub} content will NOT be visible once the visitor is logged in.  This allows you to put a call to action (like “please register or a puppy will die every 10 minutes until you do”) which will disappear once they are logged in.

The Hider plugin does actually support more user group roles so that only managers or admins can see particular content but I do not believe that it works with K2 groups. Maybe Dioscouri will update their plugin at some point…

Anyways, thanks to the Dioscouri team for making this very usefull and free extension :-)