Same plugin for different type of content

Hi @all, I need to publish two types of content in my net:

  1. Restaurants
  2. Live concerts

For first I will use hypePlaces, and for the second the same plugin is valid too, but I need different views for each type of content (example: places/all - concerts/all, places/group - concerts/group,...), and different widgets for groups and profiles, so I can´t use the same plugin but my question is, is a good way to duplicate the plugin?, I think changing subtypes and pugin name it can be possible, but I dont know if it is a good idea, or if there is another way to achieve my target.

Any suggestion is welcome :)  

  • Has anyone had the same case?

  • Hi Javier

    I am not familiar with hypePlaces but in general you could define different classes/subtypes. So you should add the entity view for this new subtype in views/objects and also some customization in form and submit/action.

    I have done something similar in sharemaps, so you see it as an example

     

  • @Ismayil can your hypePrototyper plugin be used for this requirement?. I´ve been taking  look to it but I don´t understand it wery well...

    Thanks @Nikos!, I´ll try ;)

  • There are multiple ways to approach this:
    1. If your views are relatively similar, use a metadata string to differentiate your objects, e.g. $place->context_id = 'group'; then use ege_from_metadata.
    2. If your objects vary greatly, I would suggests registering new subtypes and handling them with classes that extend the place class.
    Generally speaking, I always discourage duplicating plugins, most things can be done as an extension.

    Prototyper is a good tool for devs that need to give more flexibility to site admins in terms of what fields to show on forms and profiles. If you have a set data model, I would suggest hardcoding it.

  • adc

    Here's the super easy way I use. You need a text editor that can search & replace. First, you should download your original plugin. Next rename the folders (so if your plugin is called xyz rename all the xyz folders to the name you want to give your new plugin, say abc) then rename any files that have the same name as the original plugin to match the name of your new plugin.. in my example, rename any files in xyz plugin called xyz.php to abc.php -next, open all files in all your renamed plugin directories in a text editor, changing all references to xyz (your old plugin) to abc(the name of your new plugin). You may have to do some fine tuning in the language files, but you will be good to go, with a brand new plugin which won't conflict with the original.

  • @adc - what about database tables?

  • adc

    These will be set up for the plugin functions as normal. Different of course, separate & for your new functions. I used this method to create filmontv & red karaoke plugin's, and a new games plugin, which all run side by side with no conflicts, simply using elgg need games as the original plugin