Duplicating PHP-Nuke modules

Chapter 22. Duplicating PHP-Nuke modules

In some situations, you may find yourself wishing a second, identical module to the one you already have installed. This requires the following general steps on your part:

  • Copy the whole module directory, say module1, to a different name, say module2, in the modules folder. You now have modules/module1 and modules/module2, where module1 and module2 are exact directory copies.

  • Copy all administrative files of module1 (if any). Search for them in admin/modules, admin/links and admin/case. The copied files should be in the same directory as the original ones.

  • Find all tables used by module1. This part may be tricky and involves close examination of the code of all files under modules/module1.

  • Locate the part(s) of the nuke.sql file (located under the sql directory of the extracted PHP-Nuke package) that creates and populates the tables used by module1. Copy that part(s) in a separate file, say nuke2.sql, and change the names of the tables involved e.g. by adding a "2" after the names. Run the nuke2.sql file, just as you had ran nuke.sql (see Section 3.2.4):

    mysql -u dbuname -p dbname < nuke2.sql
    
  • Inspect the code of all files under modules/module2 and change the table names to reflect the changes in nuke2.sql, e.g. by adding a "2" to every table that is specific to module2. Also change any references to administrative files to point to the copied ones. Check the code of the copied administrative files too.

  • If your module uses any "op" parameter from the URL, you need to edit all the "op" input fields and all the calls to/from those "op's" in the admin/case file.

  • If the duplicate module should use different texts from the original ones, then you should create the appropriate entries in the language files (under admin/language/, modules/YourModule/ and language/).

  • Activate module2 from the administration panel (Section 7.1)

As you can see from the above, duplicating modules can be a fairly complicated enterprise (see also How do I duplicate modules?, Multiple Content Modules). In what follows, we will demonstrate this general procedure in a real world example - duplicating the FAQ module.

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 338,872,615
  • Today: 43,219
Server InfoServer Info
  • Oct 17, 2017
  • 02:07 pm PDT
 
 

Daily Inspiration