You are here:Home»KB»Web Design»CMS»Joomla»Extension Development»Rename a Joomla plugin or create a second instance of it
Monday, 28 December 2015 20:23

Rename a Joomla plugin or create a second instance of it

Written by

This tutorials will allow you to run a second instance of a plugin completely separate. We will be using K2 Extended search for this tutorial as this is a prime example of why you would want this feature.

Scenario

I wanted to be able to run 2 instances of this plugin because I made the plugin so I could specify which categories and articles it searched. With 2 instances of the same plugin I can now have search results for certain categories or knowledge bases in separate search names spaces in a Joomla search. This allows easier searching and I can also control the results easier.

Prerequisites

  • Workout you new name for the plugin. If you just want a second instance of a plugin keep the file names name similar. K2 Extended Search B
  • Extract the plugin package on your PC

Files

  • Rename the following files as show below. You will see I have just appended ‘b’ on the end of k2extended to keep in line with your new plugin name. You could use a program to change all of these file names as per your choice
    • k2extended.php à k2extendedb.php
    • k2extended.xml à k2extended.xml
    • language/en-GB/ en-GB.plg_search_k2extended.ini
      -->
      language/en-GB/ en-GB.plg_search_k2extendedb.ini
    • language/en-GB/ en-GB.plg_search_k2extended.sys.ini
      -->
      language/en-GB/ en-GB.plg_search_k2extended.sys.ini

File Content

  • Open all plugin files in Notepad++
  • With case sensitivity on, Text replace in all open files K2EXTENDED à K2EXTENDEDB
  • With case sensitivity on, Text replace in all open files k2extended àk2extendedb
  • Change the plugin descriptions as required in k2extendedb.xml
  • In k2extendedb.php change (the class title)
    class plgSearchK2Extended extends JPlugin
    -->
    class plgSearchK2ExtendedB extends JPlugin

Finalization

  • Zip up the files
  • Upload the new plugin to your test server to make sure it works as expected and does not overwrite your donor’s plugin
Read 1149 times Last modified on Monday, 28 December 2015 20:25