We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1586
    • 33 Posts
    Hello!
    I have found a small problem... When I create new document or folder, the checkbox "Show in menu" is checked by default. HOW TO UNCHECK IT BY DEFAULT? I didn’t find this option in settings, so I think it only can be fixed in code, but where to find it?
      • 10487 MODX Staff
      • 1,535 Posts
      It will be somewhere in manager/actions/mutate_content.dynamic.php
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 1586
        • 33 Posts
        No... In mutate_content.dynamic.php I just found this:

        <input name="hidemenucheck" type="checkbox" <?php echo $content['hidemenu']!=1 ? 'checked="checked"':''; ?> onClick="changestate(document.mutate.hidemenu);"><input type="hidden" name="hidemenu" value="<?php echo ($content['hidemenu']==1) ? 1 : 0 ;?>" />


        Pay attention to this piece of code:

        <?php echo $content['hidemenu']!=1 ? 'checked="checked"':''; ?>


        This code reads 1 or 0 from somewhere, and then checks or unchecks checkbox. But I don’t know anything about php and sql... So, please help to find where from this code reads checkbox-setting...
          • 10487 MODX Staff
          • 1,535 Posts
          Quote from: andreww at Nov 05, 2006, 02:59 PM

          Pay attention to this piece of code:
          <?php echo $content['hidemenu']!=1 ? 'checked="checked"':''; ?>

          Yes, and change that to:
          <?php echo (isset($content['hidemenu']) && $content['hidemenu']!=1) ? 'checked="checked"': (!isset($content['hidemenu']) ? 'checked="checked"' : '' ) ; ?>

          Just needs an extra conditional in there to set the default wink
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 6726
            • 7,075 Posts
            Thanks Garry that should come in handy smiley
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 1586
              • 33 Posts
              Quote from: garryn at Nov 05, 2006, 03:28 PM

              Quote from: andreww at Nov 05, 2006, 02:59 PM

              Pay attention to this piece of code:
              <?php echo $content['hidemenu']!=1 ? 'checked="checked"':''; ?>

              Yes, and change that to:
              <?php echo (isset($content['hidemenu']) && $content['hidemenu']!=1) ? 'checked="checked"': (!isset($content['hidemenu']) ? 'checked="checked"' : '' ) ; ?>

              Just needs an extra conditional in there to set the default wink

              Hm.... Is this works? I’ve tried, but with no result....
                • 31037
                • 358 Posts
                I’m not sure, but when looking at the code it seems like both options will make the same outcome.

                Try change
                <?php echo (isset($content['hidemenu']) && $content['hidemenu']!=1) ? 'checked="checked"': (!isset($content['hidemenu']) ? 'checked="checked"' : '' ) ; ?>

                to
                <?php echo (isset($content['hidemenu']) && $content['hidemenu']!=1) ? 'checked="checked"': (!isset($content['hidemenu']) ? '' : 'checked="checked"' ) ; ?>


                Warning, I’m a newbie, could be totally wrong!

                EDIT: First version was wrong, I’ve changed it now. The code suggested above now works for me.


                EDIT #2. No, wrong again, it unchecks it default, but when saving it sets is to checked anyway... I’ll delete this post! Sorry!
                  • 31037
                  • 358 Posts
                  Andreww, I changed my suggestion above, see edited post.
                    • 1586
                    • 33 Posts
                    Guys, this is completely wrong way, because we try to check-off this checkbox in..... mmmmm..... in "interface front-end", whereas it is correctly to change this setting in the core of the engine. Sorry for my bad english, but I hope I said understandably?