We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Amazingly elegant. Thanks!
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 1169
      • 312 Posts
      Hi guys

      I was wondering where we find out all this grand stuff I must admit it looks very elegant.

      Could you please take a look at
      http://modxcms.com/forums/index.php/topic,47278.msg278988.html#msg278988

      and various other questions in previous posts as I am still not sure which way to be looking to make a start on this project.

      Thanks
        DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
        • 3749
        • 24,544 Posts
        After seeing how slick the xPDO methods are, I think I would create a custom DB table (using splittingred’s tutorial) to hold the extra fields, then merge them with the user profile when you need them so they could all be accessed through the profile. Updates would be much easier that way, since you wouldn’t have to remember where things are stored.

        As an alternative, you could still put the extra fields in the user setting table, though that would entail some system for knowing which field data to put where (with different users creating different fields).

        One consideration might be what’s closest to the way the Evo version of WLPE does it.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          While WLPE uses a custom table (with a default custom table if none is specified), I noticed that Scotty’s SkinGraft actually does an ALTER TABLE on the site_templates table to add the two fields SkinGraft uses.
            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
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: sottwell at Mar 28, 2010, 01:35 AM

            While WLPE uses a custom table (with a default custom table if none is specified), I noticed that Scotty’s SkinGraft actually does an ALTER TABLE on the site_templates table to add the two fields SkinGraft uses.
            No components should EVER alter core tables or files. That’s all I’m gonna say on that one.
              • 1169
              • 312 Posts
              Thanks Bob and Susan

              I am thinking along the lines of using existing tables modx_users and modx_user_attributes

              Are there definitions for the fields class_key & role

              I forsee the first problem here to distinguish users so that ’web’ users can not log into manager.

              I see OpenGeek has posted a remark.

              @OpenGeek could you please clarify if you mean structure or content ie. can a component change email address for eg.

              Thanks
              Allan
                DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
                • 3749
                • 24,544 Posts
                Quote from: allanb at Mar 28, 2010, 09:31 AM

                Thanks Bob and Susan

                I am thinking along the lines of using existing tables modx_user and modx_user_attributes

                Are there definitions for the fields class_key & role

                I forsee the first problem here to distinguish users so that ’web’ users can not log into manager.

                I see OpenGeek has posted a remark.

                @OpenGeek could you please clarify if you mean structure or content ie. can a component change email address for eg.

                Quick note: You probably know this, but it’s modx_users, not modx_user, and you shouldn’t it in your code because the table prefix might not be modx_. Instead, it would be:
                $modx->getTableName('modUsers');


                With xPDO, you wouldn’t actually need the table name:
                $user = $modx->getObject('modUser', array('username'=>'bobray'));



                class_key is the MODx class name of the object in that row (modUser in this case). IOW, each row with that class key is related to a single modUser object. In the site_content table, you might see modDocument, modWeblink, modSymlink, etc.

                Role was used in Evo to record the role of the user (since users could only have one role). In Revo, users can have many roles (one for each user group they’re in) so roles are in the member_groups table. I see that in Revo, the role field in the user_attributes table is 1 for the admin user and 0 for everyone else, so it may be used to distinguish the admin super user.

                I can answer your last question also. It’s common for components to modify the data in MODx tables, it’s modifying the structure (e.g. adding fields) that shouldn’t be done.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 1169
                  • 312 Posts
                  Thanks Bob

                  Have edited modx_user to users.

                  typo I think I was aware it was users.

                  Where is the class_key defined huh

                  I have installed login in revo.
                  Does revo use the setting in the manager to send emails from login huh

                  Allan
                    DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
                    • 3749
                    • 24,544 Posts
                    Quote from: allanb at Mar 28, 2010, 04:45 PM

                    Thanks Bob

                    Where is the class_key defined huh
                    I’m not sure I understand this question. Can you tell me why you want to know so I don’t have to give you a bunch of different answers? wink


                    I have installed login in revo.
                    Does revo use the setting in the manager to send emails from login huh
                    Allan

                    I haven’t looked, but I’m almost sure it does. It would use emailsender and be affected by the SMTP settings (if they enable SMTP). If so, you can very likely override them with parameters in the snippet tag.

                    [Update] You got me curious, so I looked at the code. It’s in core/components/login/model/login/login.class.php. It does use emailsender and you can override it with the &emailsender parameter. I think the parameter would have to go in the ForgotPassword and/or Register snippet tags, though, since the Login snippet itself doesn’t actually send any email as far as I can tell.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 1169
                      • 312 Posts
                      Hi bobQuote from: BobRay at Mar 28, 2010, 04:54 PM

                      Quote from: allanb at Mar 28, 2010, 04:45 PM

                      Thanks Bob

                      Where is the class_key defined huh
                      I’m not sure I understand this question. Can you tell me why you want to know so I don’t have to give you a bunch of different answers? wink

                      class_key is the MODx class name of the object in that row (modUser in this case).

                      I was wondering if this was defined anywhere. Could I use webUser for example for those users with no access to the manager huh
                      modUser is the db default.

                      Allan
                        DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31