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

    i encountered the same problem you’ve described. The problem indeed occurs only with an additional table.
    In my case, most of the user information are saved in the default table of MODx (web_users_attributes) and some values in an additional table (web_user_extended).
    While the default table do not need values in each field, the additional table is having problems when no values are set for the user.
    Looking into the table using phpMyAdmin I found out if no value is set for any of the field in the "extended" table, no row will be created for the user.

    Honestly, I have no idea if this a or the problem, it’s just a guess! smiley

    Uncle68, maybe it helps you in any way...
    Oh and thank you for this fabulous snippet!! This is definitely a great advantage for MODx! grin
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      This may be related to the configuration of your database, and the way the new table was created. If your database is set to "strict" mode, it can require a value for each field, and the MySQL error is being suppressed by MODx so you don’t see it. Or something like that; I haven’t had it happen to me yet, so I’m still a bit hazy on the details.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 31037
        • 358 Posts
        Hi all! Thanks for trying to help! smiley

        The things you suggest will definitely be of great help trying to find the problem. Actually, I had the same problem early in the development, I solved it but can’t remember how and what the problem was! tongue

        Looking into the table using phpMyAdmin I found out if no value is set for any of the field in the "extended" table, no row will be created for the user.
        That’s strange, I’ve designed it to always add a row in the extended table if user is added to default table. I must recheck that function to see if it works as needed.

        Jester said:
        when I went back to one of the snippets I authored, I had the same problem about remembered how it worked exactly
        He is very right, I really need to dig into PPP again to "relearn" it in the near future, just need to finishing up a project first.

        Thanks all for the great feedback!

        /Uncle68

          • 26482
          • 138 Posts
          Hi,

          Thanks for all the help. Really appreciate it!

          I’ve since dugg into my MSQSL tables. It turns out my ppp table had a different colocation. Changed, but didn’t help. I then thought about the other hints and found that there were more webusers than rows in the ppp table. Added all webusers to the ppp table, but that also didn’t help.

          I’m at a loss here. i *know* it’s possible, I’m just not getting it grin

          Thanks again, keep the tips coming...
            • 10573
            • 101 Posts
            Here is my edit your profile call:

            [[ppp? &useTable=`web_user_test`]]
            <input style="display:none;" type="text" name="wuid" value="[+id+]" /> 
            [!eForm? &formid=`inputForm` &tpl=`ProfileForm` &noemail=´1´ &eFormOnBeforeMailSent=`updatetable` &eFormOnBeforeFormMerge=`populate`!]


            I was going through the 3 different text files and i tried making just one custom attribute called membersince. But in the "edit your profile" page, every time I try to save a value into it, I get 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 '' at line 1 »
                  SQL: SELECT * FROM `myorg_modx`.modx_web_user_test WHERE webuser = ; 


            Here is my profile "ProfileForm" form:
            <p><span style="color:#900;">[+validationmessage+]</span></p>
            
            	<form method="post" id="inputForm" action="[~[*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><label accesskey="m" for="membersince">Member Since:</label>
            	<input type="text" name="membersince" value="[+membersince+]" maxlength="60" eform="MemberSince::1" /></p>	   
            	<p><input type="submit" name="submit" value="Send"></p>
            	</form>


            If anyone has gone through an install recently, could you please write a wiki entry?
            http://wiki.modxcms.com/index.php/Category:Snippets

            The 3 different instruction parts was a little hard for me to follow.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Have you tried the snippet call uncached?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 31037
                • 358 Posts
                gcruz, I know the instructions are a bit heavy, I should rewrite them, but I just get more and more other stuff to do sad

                But your problem is easy to solve, you have put the "<input style="display:none;" type="text" name="wuid" value="[+id+]" /> " in the wrong place, it should be in your form template, the one you call "ProfileForm".

                I hope that is the correct answer, forgotten most of how PPP works, I’m to old, my brain doesn’t work anymore tongue

                /Uncle68
                  • 10573
                  • 101 Posts
                  Thanks for taking the time to look. Moving it to the form helped!

                  I would hope that you would be able to find time to improve this useful snippet! Great work!
                    • 31037
                    • 358 Posts
                    Great that it worked!

                    Yes, I really would like to improve it, or if some one else took it over. I don’t know if it’s possible to build on my code, but perhaps some similar snippet is under development.

                    If I understand correctly I must rewrite some of the code to work with comming 0.97, so sooner or later I have to dig into it again smiley
                      • 3758
                      • 17 Posts
                      sderuiter,

                      to solve your problem with the custom fields you have to change a single word in the "ppp.resources.inc.php" on line 244

                      
                      ...	
                         $sql .= ' RIGHT OUTER JOIN ' . $table_custom . ' c ON u.id = c.webuser';
                      ...
                      
                      


                      Change RIGHT to LEFT wink

                         $sql .= ' LEFT OUTER JOIN ' . $table_custom . ' c ON u.id = c.webuser';
                      


                      In my case it worked pretty well! Please don’t ask me why, a friend of mine help me out with this. Maybe Uncle68 can explain it laugh