Highlighting registered only articles

This brief article will tell you how to make highlights on registered access only article content similar to the default highlighting found on unpublished articles when a user is logged in. It covers Joomla 2.5.x.

This is not so important if your articles are not mixed together with differing permissions groups. Recently however I was asked to create a visual representation of both unpublished and registered article states for the logged in user. The paradigm was unconventional in that we want to use "Registered" as a type of hint that this article is "Pending". Starting from scratch an administrator/webmaster would be better off creating this access type from the beginning before applying the following technique.

You will need to create an override of the blog.php file found at /components/com_content/views/category/tmpl/blog.php if using a category blog layout. You will need to use a different view to target the required effect at that layer.

Copy the blog.php file to /templates/your_template/html/com_content/category/blog.php and edit this file, not the one at the original location. This will preserve your changes when upgrading Joomla.

Find the two lines in blog.php where you see the following reference (you can do a file search):

echo $this->loadTemplate('item');

And change them to look like the following:

if($item->access > 1){ echo "
";} echo $this->loadTemplate('item'); if($item->access > 1){ echo "

If you refresh your test page nothing will happen as we have yet to manipulate the style sheet (CSS). Edit your main template file, usually found at /templates/your_template/css/template.css and add the following at the bottom:

#members {
  background:    none repeat scroll 0 0 #E8EDF1;
  border-bottom: 4px solid #C4D3DF;
  border-top:    4px solid #C4D3DF;
#members h2:after {
  content:       " - Registered";
  font-style:    italic;

Try it out by changing a category blog article to unpublished, then published but registered, then both unpublished and registered to see the overlay effect. Make adjustments to colours and border sizes until you get the desired effect.

Hope this helps someone.

Share on Myspace

Latest News

Joomla 3 - Add language file support for plugins

Do this...

* Load the language file on instantiation.
* @var    boolean
* @since  3.1
protected $autoloadLanguage = true;

Generic domains names now available

Here's a full list of "Generic" domain names you probably never thought were available (register at http://hosting.noxidsoft.com):

Heartbleed security issue - OpenSSL

Do not rush to change all your passwords!

Let me qualify that statement. I have heard and seen many knee jerk reactions from "professionals" that state we should all rush out to change our banking and social media passwords. The first question we should be asking is, what, who, why. The second, do I need to make a change right away, if at all.

What systems are affected?

Simple. All systems that use the OpenSSL security certificate service.

Login Form