2

During plugin installation, is it possible to set it to be always the last one in its group? Thanks

1
  • Is this for a custom plugin you are writing? Aug 16, 2016 at 1:55

1 Answer 1

1

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;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.