We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38970
    • 59 Posts
    Hello,

    Hopefully this is the right section, I just started using modx and have a few questions:

    1)I am trying to figure out a way to use getresources to display resources based on what is in the extended fields profile.

    I have an x beside resource listings that when clicked will add that resource ID to their extended fields.

    Is there any way I can use getresources or something similiar so when listing the resources for a parent that it does not show the resources that are listed in their extended fields.

    2) This is how I am changing the extended fields
    <input type="hidden" name="offer[[+id]]" id="website" value="Pending" /> What i would like to do is use categories Paid, Unpaid, Pending but when i do Pending[[[+id]]] it doesnt show the ID at all.

    3) <input type="hidden" name="offer[[+id]]" id="website" value="Pending" /> I would like to completely remove offer however if i just do it numeric it will not insert into extended fields, it needs to be alpha numeric ?

    Thanks for all the help and information in advance.
      • 38970
      • 59 Posts
      I think I figured it out here:

      <?php
      $properties =& $scriptProperties;
      //unset($properties['tpl']);
      $profile = $modx->user->getOne('Profile');
      $fields = $profile->get('extended');
      $fields = array_keys($fields);
      foreach($fields as $key => $f){
      $test = str_replace('offer','',$f);
      if(is_numeric($test)){
      $fields[$key] = $test;
      }else{
      unset($fields[$key]);
      }
      }
      $fields = array_values($fields);
      $fields = implode(',-',$fields);
      $properties['resources'] = '-'.$fields;
      $output = $modx->runSnippet('getResources', $properties);

      return $output;
        • 38970
        • 59 Posts
        Still need to figure out how to do #2, #3