How to install cb plugin during ext. installation?

11 years 6 months ago #210357 by THE_AI
For our hotspots component: demo.compojoom.com/hotspots we have a cb plugin that displays the last locations that a user has entered. I want to distribute this plugin together with our main component package and install it in cb while we install our component. If it was a normal plugin one could do
$installer = new JInstaller;
$isntaller->install('path_to_package');
but since it is not a normal joomla plugin, but a cb plugin I'm a little lost how to use the cb framework for this.
I tried this:
      if(JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) {
            require_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php');
            $cbInstaller = new cbInstallerPlugin();
            $cbInstaller->install($parent->getParent()->getPath('source').'/components/com_comprofiler/plugin/user/plug_hotspots');
        }

but then I have fatal errors from missing functions etc...

Any advise on this would be much appreciated!
Thank you!
Daniel

Please Log in to join the conversation.

11 years 6 months ago #210368 by nant

Please Log in to join the conversation.

11 years 6 months ago #210370 by THE_AI
I managed to do the trick. Here is the code in case anyone wants to do something similar:
if(JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) {
            global $_CB_framework;
            require_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php');
            require_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.class.php');
            require_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/comprofiler.class.php');

            require_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php');

            $cbInstaller = new cbInstallerPlugin();
            if($cbInstaller->install($parent->getParent()->getPath('source').'/components/com_comprofiler/plugin/user/plug_hotspots/'))
            {
                // do something
            }
        }
The following user(s) said Thank You: beat, pelloq1

Please Log in to join the conversation.

11 years 6 months ago #210377 by beat
Thanks for sharing :)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.219 seconds

Facebook Twitter LinkedIn