We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31037
    • 358 Posts
    First, sorry for waisting your time with this unnecessary problem in ppp 0.3. Nothing is wrong in the code, it’s my instructions that are bad.

    This was causing the error:
    For the new version to work you must add a line in the eForm template for the editing page. This information comes in part 3 of the documentation. But that’s too late as you need to add this line earlier. Also this line is needed to be added in eForm template regardless if the template is for editing users own profile, or an admin editing another user. That is not very clear in the instructions.

    Solution:
    This line should be added to any eForm template for editing users:

    <input style="display:none;" type="text" name="wuid" value="[+id+]" />
    (For some reason "type=hidden" does not work for me, that’s why I use "display=none".)

    Testers needed:
    Before I change the instructions it would be great if someone could confirm that this solves the problem.

    One last thing: When designing the code I didn’t expect that this line would be needed in the eForm template for editing own user data. I must check the code again to see that this will not make it less secure. If that’s the case I’ll post an update of ppp.
    But please go ahead and test if the solution above works for you.


    EDIT: This doesn’t affect security, ppp is as secure (or unsecure) as before.

    Thanks!

    /Uncle68
      • 7455
      • 2,204 Posts
      I am getting this error now;
      « MODx Parse Error »
      MODx encountered the following error while attempting to parse the requested resource: 
      « PHP Parse Error » 
        
      PHP error debug 
        Error:  Invalid argument supplied for foreach()   
        Error type/ Nr.:  Warning - 2   
        File:  /home/httpd/vhosts/isail.nl/httpdocs/ppp.resources.inc.php   
        Line:  71   
        Line 71 source:  if ($key=='sessionid' or $key=='failedlogincount') continue; //Would anyone need those?    
        
      Parser timing 
        MySQL:  0.0130 s (19 Requests) 
        PHP:  0.0623 s   
        Total:  0.0753 s   
      
      


      using this call:[[ppp? &adminListPH=`1` &addFields=`1` &useTable=`web_user_test`]]

      it worked 1 time I think
        follow me on twitter: @dimmy01
        • 7455
        • 2,204 Posts
        another bug I think I noticed that on the one instance that the snippet work it return wrong user information

        normaly when you create a new webuser the id from the web_user table is the same as the web_user_atributes table but we where working on some homebrew snippets that created only web-users without the link to the atributes. you code uses the web_users table id to read both the web-users and web_users_atributes table but you need to check the internalKey to select the right table not the id the id can like in our case differ from the internalKey that connects the web_users table and the web_users_atributes.

        This tool could realy help us in lots of cases I hopte that you can find the time to make it more stable. When I can I will help you out in bugtesting this baby.

        Dimmy
          follow me on twitter: @dimmy01
          • 31037
          • 358 Posts
          Thanks Dimmy, this is exactly the kind of help I need!

          I have tested ppp in many ways, but two things make it hard for me to find errors before they happens:
          1. I’m a php and sql newbie smiley
          2. My experience in MODx is also still very limited and I don’t know what to test for!

          So to make the code better I really need feedback from testers, so again, thank you for the help.

          And for the problems in your posts above:

          I had no idea that there would be occasions where only table web_users are used alone, without also adding a post in web_user_attributes. If there isn’t a corresponding row in attributes sure it will generate an error as in your first post. And also it would make ppp to select the wrong user under certain circumstances.

          I have used internalKey when putting info into the database, but not when retrieving. Stupid error!

          Both these errors would not affect most users, but the internalKey stuff I’ll fix asap as it’s such an easy fix.

          I’ll also add some logic to check if user exist in attributes table before trying to fetch data.

          Sorry to say, I’ve already spent way over 500 hundred hours in making ppp (including reading php, sql and MODx manuals tongue) and at this moment my time is more limited as I have several web site projects going on. But when someone finds any problem I sure try to fix them, and perhaps also add some new features on request.

          Again Dimmy, I thank you for finding out these problems! And if you find time to do some bugtesting that’s even better! smiley

          To Other ppp-users:
          If I understood the above problems correctly, these problems wouldn’t occur for the majority of users. If you’re using customized ways of adding users instead of the "built in" that comes with MODx default, you could ran into trouble.

          And lastly, as always: PPP is under development status, problems will occur. smiley
            • 7455
            • 2,204 Posts
            ok I made sure that the web_user id and and the web_user_atributes id are the same.
            now the I am able to add custom fields.

            I also added the eform hidden field as you explained before, the form is displayed but when I press send it gives me this error:

            « MODx Parse Error »
            MODx encountered the following error while attempting to parse the requested resource:
            « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE webuser = 46' at line 1 »
                  SQL: UPDATE `isail`.modx_web_user_test SET WHERE webuser = 46;
                  [Copy SQL to ClipBoard]
             
            Parser timing
              MySQL: 	0.0568 s	(29 Requests)
              PHP: 	0.0942 s	 
              Total: 	0.1510 s	 
            
              follow me on twitter: @dimmy01
              • 2430
              • 12 Posts
              webuser = 46 zou moeten zijn webuser = ’46’ denk ik...

              ----------------- english ----
              I think there is an error in your syntax where webuser = 46 has to be webuser = ’46’
              But it is a wild guess...

              UPDATE `isail`.modx_web_user_test SET WHERE webuser = ’ " . $id . " ’;
                • 7455
                • 2,204 Posts
                Quote from: Auke at Jan 11, 2007, 05:37 AM

                webuser = 46 zou moeten zijn webuser = ’46’ denk ik...

                ----------------- english ----
                I think there is an error in your syntax where webuser = 46 has to be webuser = ’46’
                But it is a wild guess...

                UPDATE `isail`.modx_web_user_test SET WHERE webuser = ’ " . $id . " ’;

                its an integer so it does not need " "

                zag dat je was langsgekomen op de test site.
                  follow me on twitter: @dimmy01
                  • 2430
                  • 12 Posts
                  hehe ;-) ja, toch even kijken of de functionaliteit van PPP wat voor me zou zijn...
                  ik ben zelf een uitgebreide profile member snippet/module aan het bouwen, vandaar..

                  -------------

                  It is indeed een integer... but still i wonder... (what if you did it like i suggested?)
                    • 31037
                    • 358 Posts
                    The problem I believe is that the field value that should be put into the database seems to be empty.

                    Could you post the contents of the eForm template for the "edit user" document here, and possible also the call to ppp and eForm?

                      • 7455
                      • 2,204 Posts
                      Quote from: Uncle68 at Jan 11, 2007, 06:40 AM

                      The problem I believe is that the field value that should be put into the database seems to be empty.

                      Could you post the contents of the eForm template for the "edit user" document here, and possible also the call to ppp and eForm?



                      ok here is the eform chunk:
                               <p><span style="color:#900;">[+validationmessage+]</span></p>
                      
                      	<form method="post" id="inputForm" action="[~[*id*]~]">
                      	<input style="display:none;" type="text" name="wuid" value="[+id+]" /> 
                      	<p><label accesskey="f" for="fullname">Your full name:</label>
                      	<input type="text" name="fullname" value="[+fullname+]" maxlength="60" eform="Fullname::1" /></p>
                      	<p><label accesskey="e" for="email">Your e-mail:</label>
                      	<input type="text" name="email" value="[+email+]" maxlength="60" eform="E-mail::1" /></p>
                      	<p><input type="submit" name="submit" value="Send"></p>
                      
                      	</form>
                      


                      and the calls;

                      [!ppp? &useTable=`web_user_test`!]
                      [!eForm? &formid=`inputForm` &tpl=`eFormTest` &noemail=`1` &eFormOnBeforeMailSent=`updatetable` &eFormOnBeforeFormMerge=`populate`!]
                      


                      and when I am not loged in as webuser I get this error on the same page:
                      « MODx Parse Error »
                      MODx encountered the following error while attempting to parse the requested resource: 
                      « PHP Parse Error » 
                        
                      PHP error debug 
                        Error:  Invalid argument supplied for foreach()   
                        Error type/ Nr.:  Warning - 2   
                        File:  /home/httpd/vhosts/isail.nl/httpdocs/ppp.resources.inc.php   
                        Line:  487   
                        Line 487 source:  $fields[$key] = $value;    
                        
                      Parser timing 
                        MySQL:  0.0160 s (20 Requests) 
                        PHP:  0.0923 s   
                        Total:  0.1083 s   
                      
                      


                      when I am logged in as webuser I see the form
                        follow me on twitter: @dimmy01