I have two plugins and i need to package them together. Is there a way to make a script to install two plugins at once? And auto publish only one of them?
This script works to one:
public function postflight($route, JAdapterInstance $adapter)
{
// We only need to perform this if the extension is being installed, not updated.
if ( $route == 'install' )
{
// Get a database object.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('enabled') . ' = ' . (int) 1
);
$conditions = array(
$db->quoteName('element') . ' = ' . $db->quote('plugin_name'),
$db->quoteName('folder') . ' = ' . $db->quote('plugin_group')
);
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
// Set the query and load the result.
$db->setQuery($query);
$result = $db->query();
}
}