Create a Custom Administrator Module for Joomla

Modules normally allow you to display small blocks of content on the frontend of your Joomla site.

However, you can also show modules in the backend. The quick icons, site information, latest articles and logged in users are all examples of this type of module.

I'm going to show you how to build a custom administrator module to show important information to your site's administrators.

Step #1. Create the XML file

Create a file named mod_yourmodulename.xml.

In my example I'm going to use mod_admincustom.xml - that will work as the manifest file to list the extension details such as name, author, copyright, version, etc.

Use the code below as base for replacing the data with your own values:

  • name - Use the same from your filename in this format: mod_yourmodulename
  • author
  • creationDate
  • copyright
  • authorEmail
  • authorUrl
  • version
  • description

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="administrator" method="upgrade">
    <author>Your Name Goes Here</author>
    <creationDate>December 2015</creationDate>
    <copyright>Copyright (C) 2015 Your Brand Goes Here</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <authorEmail>This email address is being protected from spambots. You need JavaScript enabled to view it.</authorEmail>
    <description>Custom Module for Administrator</description>
        <filename module="mod_admincustom">mod_admincustom.php</filename>

Note, the module's name is repeated three times in name and filename tags. Be sure to replace it with your own custom name.

Step #2. Create the PHP file

Create a file named mod_yourmodulename.php - such as mod_admincustom.php

Use the code below to print the popular "Hello world!" phrase:

defined('_JEXEC') or die;

<div class="btn-group viewsite">Hello world!</div>

This line ensure the code's file will be executed only through Joomla.

defined('_JEXEC') or die;

Step #3. Create the installer

Move the files from step 1 and 2 inside a folder with the name of your module. In this case, the name of the folder is "mod_admincustom".

Custom Module for the Joomla Backend

Compress the folder as a zip file.

Custom Module for the Joomla Backend

Step #4. Install the custom module

Install the zip file from the previous step as you would install any regular extension. Go to Extensions > Manage > Upload package file:

Custom Module for the Joomla Backend

Step #5. Test the custom module

Let's display the module in one of the module positions of the backend template.

  • Go to Extensions > Modules
  • Set Filter to "Administrator", in order to manage modules for the backend.
Custom Module for the Joomla Backend

The list of administrator modules are displayed immediately:

Custom Module for the Joomla Backend
  • Click the "New" button:
Custom Module for the Joomla Backend
  • Choose your custom module:
Custom Module for the Joomla Backend

On the right side of the screen, choose a position such as status, cpanel, title, toolbar, etc. As I want to display my module in the footer, I selected the "status" position:

Custom Module for the Joomla Backend
  • Set module status as "Published".
  • Click Save and close.

Step #6. End result

See the new module in action:

Custom Module for the Joomla Backend