I have created a package in Joomla 3 that includes a module and a plugin. It installs both the module and plugin correctly but the plugin is disabled by default. Is there a way to make the plugin enabled by default- perhaps in the xml manifest of the package? I am unable to figure this out.
0
votes
2 Answers
4
votes
As @lodder already mentioned you can write your install script like
public function install ($parent)
{
$query = "update `#__extensions` set enabled=1 where type = 'plugin' and element = 'your-extension'";
$db = JFactory::getDBO();
$db->setQuery($query);
$db->query();
// Probably you want to enable the module on all pages too
$query = "insert into `#__modules_menu` (menuid, moduleid) select 0 as menuid, id as moduleid from `#__modules` where module like 'mod_my-awesome-menu%'";
$db->setQuery($query);
$db->query();
}
You can find my working example here https://github.com/Digital-Peak/DPAttachments/blob/master/com_dpattachments/script.php#L15