Highlighting registered only articles

Make registered articles really clear in Joomla.

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.