We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9359
    • 128 Posts
    Hello everyone,
    I have to create a site where registered users can create ads.
    I should therefore make sure that a web user can create a resource.
    You know what I could do with Modx?
    thanks to all
      "Destiny is not a matter of chance, it's a matter of choice"
      • 30023
      • 172 Posts
      Quote from: fabryshock at Nov 15, 2012, 02:42 AM
      Hello everyone,
      I have to create a site where registered users can create ads.
      I should therefore make sure that a web user can create a resource.
      You know what I could do with Modx?
      thanks to all

      http://modx.com/extras/package/resourceeditor
        • 9359
        • 128 Posts
        Thx TimGS.
        Unfortunally i'm not able... when a web user try to create new resource: "Error - Creation of new resources not allowed.". Why?????? :-(

          "Destiny is not a matter of chance, it's a matter of choice"
          • 30023
          • 172 Posts
          Quote from: fabryshock at Nov 19, 2012, 07:10 AM
          Thx TimGS.
          Unfortunally i'm not able... when a web user try to create new resource: "Error - Creation of new resources not allowed.". Why?????? :-(

          Have you seen the snippet parameter documentation at the top of the snippet itself?

          &editOnly is the one you need to look at and probably to set to `0`.

          -- Tim.
            • 9359
            • 128 Posts
            Thx Tim,
            yes this is my call...
            [!ResourceEditor? &formtpl=`pk.news.input.tpl` &tvfields=`img1,img2,img3,img4` &requiredFields=`pagetitle,introtext` &aliastitle=`1` &canpost=`` &logging=`1` &folder=`308` &editOnly=`0` &template=`annuncio` !]

            but this is the output: Creation of new resources not allowed.

            The problem is in ResourceEditor snippet at line 440:
            // check if current webuser has rights
            if(!$allowAnyPost && !$modx->isMemberOfWebGroup($postgrp)) return 'You are not allowed to publish articles';

            to solve this issue i have put $allowAnyPost=true;
            and now it's works.... but is not great solution :-(
              "Destiny is not a matter of chance, it's a matter of choice"
              • 9359
              • 128 Posts
              Tim, another question:

              i have a tv named img1, and it's a image.
              in the form for create new resource how i can upload new image?

              This not work :-(
              <input class="field" type="file" value="[+img1+]" size="10" maxlength="255" name="img1">


              Many thx
                "Destiny is not a matter of chance, it's a matter of choice"
                • 30023
                • 172 Posts
                Hi,

                First issue - if the output is "Creation of new resources not allowed", then the problem is nothing to do with line 440, which returns something quite different! If you are actually getting "You are not allowed to publish articles" from line 440, then try not passing a value of any sort for &canPost. I suspect there may be a small bug where passing &canPost=`` results in unintended behaviour, whereas missing it off entirely should be fine.

                Regarding your file issue, saying "This not work" whilst undoubtably true is not going to help anyone help you - you need to report which error messages occur. If none occur, that is also something to report. If you post more info I may be able to help.

                -- Tim.
                  • 9359
                  • 128 Posts
                  Quote from: TimGS at Nov 20, 2012, 05:18 AM


                  Regarding your file issue, saying "This not work" whilst undoubtably true is not going to help anyone help you - you need to report which error messages occur. If none occur, that is also something to report. If you post more info I may be able to help.

                  -- Tim.

                  Hi Tim,
                  the form not send me any errors :-(
                  but the image is not uploaded and the tv img1 in the resource still empty.
                  Which information can be useful to solve the problem?
                  This is my form template:
                  <form name="NewsEditor" method="post" action="[~[*id*]~]" enctype="multipart/form-data">
                  			<fieldset>
                  				Titolo Annuncio:<br /><input name="pagetitle" type="text" size="40" value="[+pagetitle+]" /><br />
                  				Descrizione breve:<br /><textarea name="introtext" cols="50" rows="5">[+introtext+]</textarea><br />
                  				Contenuto annuncio:<br /><textarea name="content" cols="50" rows="8">[+content+]</textarea><br />
                                                  Condizioni: <br /><fieldset name="condizioni" id="condizioni">[+condizioni+]</fieldset><br />
                                                  Categoria: <br /><fieldset name="categoria" id="condizioni">[+categoria+]</fieldset><br />
                                                  Autore: <br /><fieldset name="autore-annuncio" id="condizioni" value="[+username+]">[+username+][+fullname+]</fieldset><br />
                                                  
                  <span class="edLabel"><label for="title">Foto del prodotto </label></span>
                  <input class="field" type="file" value="[+img1+]" size="10" maxlength="255" name="img1">
                  			
                  			<fieldset>
                  				<input name="NewsEditorForm" type="hidden" value="on" />
                  				<input name="editid" type="hidden" value="[+editid+]" />
                  				<input name="send" type="submit" value="Submit" />
                  			</fieldset>
                  </form>
                  
                  [ed. note: fabryshock last edited this post 13 years, 10 months ago.]
                    "Destiny is not a matter of chance, it's a matter of choice"
                    • 9359
                    • 128 Posts
                    This works!!!! enjoy

                    Foto del prodotto <br/>
                    <input class="field" type="file" value="[+img1+]" size="30" maxlength="255" name="img1" /><br/>
                    <input class="field" type="file" value="[+img2+]" size="30" maxlength="255" name="img2" /><br/>
                    <input class="field" type="file" value="[+img3+]" size="30" maxlength="255" name="img3" /><br/>
                    <input class="field" type="file" value="[+img4+]" size="30" maxlength="255" name="img4" /><br/>
                    <input class="field" type="file" value="[+img5+]" size="30" maxlength="255" name="img5" /><br/>
                    <input class="field" type="file" value="[+img6+]" size="30" maxlength="255" name="img6" /><br/>
                    </fieldset>


                    Many thx
                      "Destiny is not a matter of chance, it's a matter of choice"
                      • 30023
                      • 172 Posts
                      Odd. Still, it works now smiley

                      You should probably dump the size and maxlength attributes. They are at best irrelevant for a file inputs.

                      I did notice that your non-working example had size="10". I can't see how that would cause any problem though.

                      -- Tim.