How To Password Protect Articles In Joomla

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

How To Password Protect Articles In Joomla

Sometimes you might want to protect an article on your Joomla website with a very simple password without visitors having to login or register.

One example of this might be if you run an event and afterwards want to give event goers access to a special area on your site where they are given a code at the event to download photos or vouchers.

Here is one I baked earlier. Type the word simple into the password box below...

Simple Password Protection
Please enter your password for access

Okay, so how do we create this magic?

To begin with we need some php code to make a simple password box and submit button. The code needs to include some validation so it can check the correct password has been entered and then redirect the visitor to the controlled page

The easiest way I have found for doing this is to use a Joomla plugin called Sourcerer which you can download for free from the Joomla Extensions Directory or direct from the developer's website

The php code I used for the example can be downloaded for free from the developer's website

Extract the contents of the zip file and open the file index.php

If you are using a code editor find line 13 which reads

$password = "admin"; // Modify Password to suit for access, Max 10 Char

Change the password to something of your choice

Next, starting line 34 find the highlighted code :
php code

This is where you can put your text, images or even another article or module which you want protected. 

Before you can put the code in a Joomla article though you must install Sourcerer

Then simply copy and paste the php code into your article and wrap it inside the source /source tags as described in the Sourcerer website

You're Done!

If you found this information useful please remember to Like us on Facebook

Your website is your online shop window and if potential customers find it difficult to navigate they are unlikely to translate into sales.

When you are working with your web developer to design your business website it can be difficult to be truly subjective about the layout of the site. You want to get everything on the home page after all!

Let us give you real and impartial advice by reviewing your website from a customers perspective.


To give you the best possible experience, this site uses cookies. Continuing to use means you agree to our use of cookies. If you'd like to learn more about the cookies we use please find out more