We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6902
    • 126 Posts
    So... I just wrote my first plugin... I had no idea. It was... beautiful [single tear] ... I can feel whole new vistas of magical opportunity opening up before me... ModX team = INCREDIBLE!

    I added a little to your code to make sure that it only added new documents to the resource group:

    <?php
    if($mode=='new'){
        $groupId = 4;
        $resourceGroupResource = $modx->newObject('modResourceGroupResource');
        $resourceGroupResource->set('document_group',$groupId);
        $resourceGroupResource->set('document',$id);
        $resourceGroupResource->save();
    }
    
      • 3749
      • 24,544 Posts
      Quote from: debussy at Dec 14, 2010, 03:28 PM

      So... I just wrote my first plugin... I had no idea. It was... beautiful [single tear] ... I can feel whole new vistas of magical opportunity opening up before me... ModX team = INCREDIBLE!

      I added a little to your code to make sure that it only added new documents to the resource group:

      Congratulations (and good catch).
      It should be:

      <?php
      if($mode==modSystemEvent::MODE_NEW){
      

        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