Community Plugins

Install, Extend, Share

Introduction

You're a great developer. You know that, right? Unfortunately, it hasn't always been easy to show your skills off to everybody else. The Community Plugins feature will change that.

Since 2009 Jomres has had the Jomres Plugin Manager. This feature allows me to create and maintain Jomres plugins, and site admins download these plugins at a single click of the button. It's a fast, effective, reliable method of rolling out new features, and improvements to existing features that aren't dependant on big new releases of the Core, and it's a significant advantage when using Jomres.

In the summer of 2023 I will be introducing a new version of the Plugin Manager which has a number of new features. These features allow third party developers to upload their own plugins to a central hub, and all site managers, regardless of whether or not they have a license for Jomres Core, will be able to download these plugins.

This article is slightly technical, as it is written for developers who use Jomres. It discusses the Community Plugins feature and how you can use it to share your work with the Jomres community. I hope to encourage developers who have built their own Jomres functionality to share those changes back to the community. This will serve as an advertisement of your coding skills, and provide you with a route to new customers that you haven't had before, and for Jomres users to take advantage of solutions that I simply haven't thought of yet.

Community Plugins

Jomres Core allows you to have different plugins in different places in your CMS's installation. Those are /jomres/core-plugin, /jomres/remote_plugins and the template override directory.

Most developers will probably use the template override directory as this is specific to their individual sites and it follows the convention that most developers use. While this is fine, a better way to organise your Jomres functionality is to put code that addresses specific problems into different directories in the /jomres/remote_plugins directory. This makes them more portable, you simply copy the contents of that directory to a server and rebuild the registry. Voila, you're building a library of Jomres features. Wouldn't it be great though if you didn't have to do the fiddly FTPing and remembering to rebuild the registry?

A simple plugin

Before you can upload plugins, you need to have a plugin to upload.

Here we'll create a simple minicomponent to output a username, and then use that script in a Jomres template shortcode.

First, we'll create a new directory in /jomres/remote_plugins/ called output_username.


In that directory we'll create a minicomponent

called j06000output_username.class.php and set the contents to the following :

defined('_JOMRES_INITCHECK') or die('');

#[AllowDynamicProperties]
class j06000output_username
{
function __construct()
    {
        $MiniComponents = jomres_singleton_abstract::getInstance('mcHandler');
        if ($MiniComponents->template_touch){$this->template_touchable = false; return; }
        $username = "Uknown user";
        $thisJRUser = jomres_singleton_abstract::getInstance('jr_user');
        if ($thisJRUser->id >0) {
            $username = $thisJRUser->username;
        }
        echo $username;
    }

function getRetVals()
    {
    return null;
    }
}

 

When a new jnnnnnxxxxx.class.php script is added or copied, you need to rebuild the registry in Administrator > Jomres > Tools > Rebuild Registry to tell Jomres that it exists.

Now you can add the following shortcode to any Jomres template file and you'll see the user's username in the template file's output.

{jomres_script output_username}

 

Upload to the Community Hub

That's great. Now, how do you distribute this plugin to the wider Jomres community?

Version 6 of the Jomres Plugin Manager includes a number of new features that allow you to upload your plugins to the Community Hub. You can then use the Jomres Plugin Manager to download those changes to other Jomres installations you run, and other users can also download them to their sites.

If you're a developer who wants to make a living distributing Jomres plugins, then you can use this feature to demonstrate your Jomres coding skills by developing and sharing plugins in the Community Hub. Offer a working plugin on the Hub, and in the plugin's documentation you can showcase enhanced versions of the plugin's features with images and videos and links to your site where other Jomres users can buy and download that plugin.

Uploading a plugin

To upload a plugin, first you need to ensure that you're running the most recent version of Jomres. Visit the Jomres Plugin Mananager and double check, to make sure.

Once it has been installed, go to the Control Panel in Jomres, and click on the Dashboard section. You will see two new menu items (Note, you will not see this on Joomla 3 installations. It will only work on WordPress and Joomla 4). These menu options are "Upload plugins" and "Your Community Plugins".



When you first visit "Upload plugins", if you haven't already saved your license server username and password in Site Configuration you'll be prompted to do that.



Go to Site Settings and save your license server username and password. If you don't have one yet, you can register for free. You do not need to have a license to use this feature.

Once that's done, you can go back to the "Upload plugins" page. If you don't have any plugins there yet, you can create one using the example above.Until you do, you'll see a message like this.

When you have a plugin that you would like to distribute, visit that page again. It will scan the /jomres/remote_plugins directory. Any subdirectories it finds, it will assume that each subdirectory is a plugin directory and it will build a form for each directory/plugin. This form is used to create the plugin's plugin_info.php file and upload the plugin to the Hub.

Here you can see an example set of form fields (this feature is being actively developed, so the fields won't be exactly the same, but you'll get the gist).



 

Populate these form fields with the information you'd like to share about your plugin, and when you're ready, hit the button to upload it to the Hub.



That's it! That's all you need to do! The plugin is now available at the bottom of the Jomres Plugin Manager's Core Plugin's tab. Any other Jomres user can install it to their sites if they want, and you can install it on your other Jomres installations.