We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18367
    • 834 Posts
    Quote from: lkfranklin at Apr 10, 2017, 05:23 AM
    You can't filter by it but you can right click on a resource and select change dates. Or you can of course multi-select and use the bulk action dropdown to change the createdon dates on multiple.

    Yeah thanks,

    I managed to figure that out.
      Content Creator and Copywriter
    • discuss.answer
      • 48146
      • 5 Posts
      pepebedesign Reply #12, 7 years ago
      For reasons I still can't follow, createon is not an available field in the resource's settings tab.

      See this discussion about this topic:

      https://github.com/modxcms/revolution/issues/12305

      You can either use a TV to display/change createdon (simple plugin working on docformsave) or you can slightly modify the code below:



      <?php
      /**
       * Sample plugin to add a "created by" field on a resource form
       *
       * @author: rtripault
       * @source: https://gist.github.com/rtripault/7306c8487a39fd1ce0db5f334c99be57
       *
       * @var modX $modx
       * @var array $scriptProperties
       *
       * @event OnDocFormPrerender
       */
      $modx->controller->addHtml(<<<HTML
      <script>
          // We are targeting the right column in the settings tab
          Ext.ComponentMgr.onAvailable('modx-page-settings-right', function(right) {
              right.on('beforerender', function() {
                  // page is a reference to the whole form panel
                  var page = Ext.getCmp('modx-panel-resource')
                      // record is a reference to our resource fields
                      ,record = page.record
                  ;
                  
                  // Let's add our new field at the bottom of the column
                  right.add({
                      xtype: 'modx-combo-user'
                      ,name: 'createdby'
                      ,hiddenName: 'createdby'
                      ,value: record.createdby
                      ,anchor: '100%'
                      ,layout: 'anchor'
                      ,fieldLabel: _('resource_createdby')
                  });
              })
          });
      </script>
      HTML
      );
      


      I haven't tried it so far, but using createdon instead of createdby should do the trick.

      Cheers,

      Patrick
        • 18367
        • 834 Posts
        Thanks Pepe,
        but asking me to modify code is always dangerous (ha).

        Took awhile but eventually I got it working.

        Exactly what I was after. Many thanks.
          Content Creator and Copywriter