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

    I am using formit2rescource to add docs from the front end.

    How can I set the menu index to the next index number. It is currently just being set as 0.

    $doc->set(’menuindex’, ’??????’);

    Stuart
      • 4172
      • 5,888 Posts
      this is from processors/resource/create.php:

      /* increase menu index if this is a new resource */
      $auto_menuindex = $workingContext->getOption('auto_menuindex', true);
      if (!empty($auto_menuindex) && empty($scriptProperties['menuindex'])) {
          $scriptProperties['menuindex'] = $modx->getCount('modResource',array(
              'parent' => $resource->get('parent'),
              'context_key' => $scriptProperties['context_key'],
          ));
      }
      $resource->set('menuindex',!empty($scriptProperties['menuindex']) ? $scriptProperties['menuindex'] : 0);
      



      you can also try to use the runProcessor-method http://api.modx.com/revolution/2.1/ for creating resources.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!