We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37521 ☆ A M B ☆
    • 30 Posts
    The new version of my extra doesn't need no longer a plugin. How to remove it after new version installed?

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      I'm not sure what you're asking. You can remove a plugin by right-clicking on it in the elements tree and selecting "Remove Plugin."

      If you're asking how to remove a plugin during the install/upgrade of an extra you've created, you can put code like this in a resolver:

      if ($object->xpdo) {
          $modx =& $object->xpdo;
          switch ($options[xPDOTransport::PACKAGE_ACTION]) {
              case xPDOTransport::ACTION_INSTALL:
              case xPDOTransport::ACTION_UPGRADE:
      
              $obj = $modx->getObject('modPlugin', array('name' => 'MyPlugin'));
              if ($obj) {
                  $obj->remove();
              }
      
          }
      }
      
      return true;
      
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 37521 ☆ A M B ☆
        • 30 Posts
        Thanks!