One of the most involved WordPress plugins I’ve coded to date is known as LXCU – Lowcows.com XML Client Update. This plugin allows me to keep anyone using one of my custom themes, plugins or widgets informed about updates right on the WordPress dashboard. I can also use it to pass information to specific clients for matters other than updates.
The plugin has its own menu in WordPress to separate it from the other menus. This way it’s easier to spot and use. Also, because of the various functions it’s nice to keep everything grouped together.
The menu has three options – Messages, Clients and Themes/Plugins. Clicking any of these will display a list of messages, clients and themes/plugin that have been stored in the database. From the list you can add, edit, view or remove items as needed. You can also activate or deactivate the items with one click. The message list also has a one click feature to set a message as important – this will make the dashboard message have a red background to stand out.
All three screens will display a list of the items for that section (similar to the image above). If you have a longer list you can use the search feature to look for a particular item.
Adding New Items
To add a new item you click on the ‘Add New’ button for the section you are working in. Then it’s just a matter of filling in the information and clicking the ‘Add’ button.
The above image shows a sample of adding a new client. If the client is using custom themes, plugins or widgets you can select the ones being used in the ‘Widgets’ select list. This way if you add a message for a client it will also display messages from any themes, plugins and widgets they are using.
Themes, Plugins and Widgets
Adding a new theme, plugin or widget is the same as adding a new client but with less information to fill out. You can set these as ‘active’ or not – if active, messages will be displayed for the users.
The message is the information that you wish for the user to see in the dashboard. You can select which themes, plugins, widgets or clients you wish to display the message for. You can select a combination of any of these that you’d like. If the message is marked as ‘important’ then it will be given a red background in the dashboard.
When selecting the message date you can either type in the date or click on the icon to open a calendar to select the date. The calendar is using jQuery’s Datepivker script – set to run in no conflict mode to avoid any issues.
Editing and Removing Items
To edit an item you click on the ‘edit’ link in the item list. This will simply take you to a screen that’s the same as the images for ‘Add New’ above – only difference is that the information is already filled in and ready to be edited.
Removing an item is as easy as clicking on the ‘remove’ link in the item list. When you do this you will be presented with a screen that will ask you to confirm the removal of that item.
One Click Features
In the item lists you have the option to quickly activate or deactivate an item with one click. In the message list you also have the ability to mark a message as being important or not with one click. Doing so will present you with a confirmation message at the top of the screen.
This plugin displays message to let you know what’s going on. It could be a quick confirmation message like the image seen in ‘One Click Features’ or the image below. Or a cancel/error message like the one seen to the right.
The WordPress Dashboard
All this behind the scenes work is meant to handle one simple display in the WordPress dashboard allowing me to keep clients and theme, plugin and widget users up to date with what they are using.
Each custom theme, plugin and widget is making a call to a file that will pull the related messages. For clients they are also passing an encrypted password to help secure the messages from being seen by ‘outsiders’.
When activated the plugin will create the database automatically and fill in both the client and theme/plugin/widget table with a default item. These default items are ‘All Clients’ and ‘All Themes, Plugins, Widgets’ – they cannot be removed or edited. They are there to save time when I need to update all clients and all users with a quick message.
Upon deletion of this plugin all database tables set up will be removed and all files (and directories) will be removed as well.