Create private content on your Joomla site

Sean Massa | June 30, 2014


Private content can be a very useful feature in a website, and setting this up in Joomla can be done in a few easy steps.

I was tasked with creating a password protected area for a Joomla site recently, in which a user would register with the websites owner to have access to specific articles that owner has created and stored on their website. After spending a fair amount of time trying to find extensions that did what I needed, the ideal solution is actually native to Joomla and required no additional plugins.

First off, we need to make sure the “Login Form” module is activated in our admin. This is the basis for creating the user registration form. This is normally activated by default in a fresh install, but if it isn’t, you can find it under Extensions > Module Manager. Just search for “Login Form” and activate and position where you’d like. There are also options related to the signup process under System > Global Configuration > Users Manager that will allow you to adjust if the signup process should be instantly activated, require the user to confirm acceptance via an emailed link or if the administrator of the website will be the only one allowed to verify user registrations.

The next, and final step in creating private content is to create an article with the content you’d like to be accessible only to those who have registered and logged in. Once you’ve added your desired content, you will see a select box in the edit article window that says “Access”. By default, this is set to “Public” meaning this content is available for anyone visiting your website, set this to “Registered” and now the content will only be visible to those who’ve logged in.

It is that Easy!

Bonus Tutorial:

Now that you have that completed, and you have users signing up to view your content, maybe you want to personalize the emails a new user receives after signing up. This, unfortunately, can not be done via your admin area, you will have to FTP in and edit some code. The code you edit depends on your preferred method of verification (which was mentioned in step one, under System > Global Configuration > Users Manager), but is all edited in the same file. For this example, we will be using no verification, meaning as soon as a user signs up, they have access.

Once you have FTP’d into your website and you are in the root folder for your Joomla install, you will need to look in the “language” folder, in that you will open the specific language folder that relates to the default language of your website, in our case, it is “en-GB”. This folder houses most of the files that create that basic responses for things you do in the admin, for our demo we need to modify the en-GB.com_users.ini file. In this file you will see a lot of variables with associated text blocks, the one we want to modify is labeled “COM_USERS_EMAIL_REGISTERED_BODY”. The default response is “Hello %s,\n\nThank you for registering at %s.\n\nYou may now log in to %s using the following username and password:\n\nUsername: %s\nPassword: %s”, which is good information to keep, so lets just add to it. You can add in whatever text based content you’d like here, a simple example would be “Hello %s,\n\nThank you for registering at %s.\n\nYou may now log in to %s using the following username and password:\n\nUsername: %s\nPassword: %s\n\nHere is some additional content that I have added manually to language/en-GB/en-GB.com_users.ini”. One thing to note, \n renders as a line break, add \n\n to simulate a new paragraph.

It will most likely take some trial and error with the emailed response to get it how you want it, but given the fact this uses all native Joomla functions and you don’t have to pay for an extension that may or may not do exactly what you like, it is worth the time figuring it out. Hopefully these instructions help save you some hassle doing this.

Add a Comment

Your email address will not be published. Required fields are marked *