During plugin installation, is it possible to set it to be always the last one in its group? Thanks
1 Answer
Yes. You need to have a installer script. Then in the install script do something like:
public function postflight($route, $_this)
{
// Get a database connector object
$db = JFactory::getDbo();
try {
// Enable plugin by default
$q = $db->getQuery(true);
$q->update('#__extensions');
$q->set($this->db->quoteName('ordering') . ' = -1')
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote('PLUGIN_NAME'))
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote('system'));
$db->setQuery($q);
method_exists($db, 'execute') ? $db->execute() : $db->query();
} catch (Exception $e) {
throw $e;
}
}