We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38282
    • 12 Posts
    Actual problem
    I've followed the tutorial at http://rtfm.modx.com/display/revolution20/Extending+modUser upto step 3 (setting extension_packages). When I want to change the class of some pre-existing user to my own class, I get a dialog saying 'user_err_nfs', and three entries are added to the error log:
    [2012-02-28 10:36:14] (ERROR @ /connectors/security/user.php) Could not load class: ClubLid from mysql.clublid.
    [2012-02-28 10:36:14] (ERROR @ /connectors/security/user.php) Could not load class: ClubLid from mysql.clublid.
    [2012-02-28 10:36:14] (ERROR @ /connectors/security/user.php) ClubLid::load() is not a valid static method.

    I've tried regenerating the the xpdo-classes, without any effect...

    What I'm trying to do
    I'm making a sports club website and I want only the members of the club to have an (active) account on the site (but special accounts not mappable to a member should still be possible). Also, club members should have access to the full member list. Since not all members will have an account, I added a custom table to contain the full member list. This table contains an 'id' field for identifying members (regardless of them having an account or not) and a 'user' field, just like in the tutorial.
    Now I want to be able to update the member list from a .csv and update the user-table accordingly:
    - deactivate any accounts of users that are no longer in the member list
    - update the profile information of the website-users according to the information in the member list
    Thus, I decided to extend the modUser-class, such that some basic stuff can be done automatically for each member that creates/activates his website account and to allow for further tweaking.

    At this point, the schema looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <model package="ledenlijst" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
    
        <object class="LedenlijstLid" table="ledenlijst" extends="xPDOSimpleObject">
            <!-- The id is 'YYYYMMDD' . md5(naam . voornaam); this should be adequate to providing unique ids -->
            <field key="id" dbtype="varchar" precision="40" phptype="string" null="false" />
            <!-- Not all members will have a user attached to it, so we must allow null -->
            <field key="user" dbtype="int" phptype="integer" null="true" />
    
            <field key="naam" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
            <field key="voornaam" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
            <field key="email" dbtype="varchar" precision="255" phptype="string" null="true" />
            <!-- other field definitions come here -->
            <aggregate alias="ClubLid" local="user" foreign="id" cardinality="one" owner="foreign" />
        </object>
    
        <object class="ClubLid" table="users" extends="modUser">
            <composite alias="LedenlijstLid" local="id" foreign="user" cardinality="one" owner="local" />
        </object>
    </model>
    


    Any help is greatly appreciated
      • 1778
      • 659 Posts
      Hello

      First of all, (and I did'nt read further) I think there's a problem in your schema with these lines :
      <object class="LedenlijstLid" table="ledenlijst" extends="xPDOSimpleObject"> // if you extend xPDOSimpleObject it automatically generate the 'id" field (which is the Primary Key) so...
              <!-- The id is 'YYYYMMDD' . md5(naam . voornaam); this should be adequate to providing unique ids -->
              <field key="id" dbtype="varchar" precision="40" phptype="string" null="false" /> // this field can't be correctly set as its name is 'id' too, if you want to set your own 'id' field as PK you have to extend xPDOObject (not xPDOSimpleObject)
              <!-- Not all members will have a user attached to it, so we must allow null -->
              <field key="user" dbtype="int" phptype="integer" null="true" />
      


      xPDOSimpleObject automatically creates the PrimaryKey with a name of 'id', and you don't have to specify it in your schema. If you want to specify your own PK with a name of 'id' you have to extend xPDOObject instead of xPDOSimpleObject, and don't forget to precise that it is the Primary key.
      Hope this helps
      Cheers
        • 38282
        • 12 Posts
        Hey anso,

        Thanks for the reply, but I'm afraid I have to say it didn't really help. I keep on getting the same error.
        Still hoping for a solution...
          • 26903
          • 1,336 Posts
          Did you get any errors when you generated your schema?
            Use MODx, or the cat gets it!
            • 38282
            • 12 Posts
            No, I didn't.
            I followed the tutorial without any error popping up until I tried changing the user class.
              • 26903
              • 1,336 Posts
              Try this :-

              <composite alias="LedenlijstLid" class="myLedenlijstLid"....

              and change to :-

              <object class="myLedenlijstLid".....
                Use MODx, or the cat gets it!
                • 38282
                • 12 Posts
                I tried changing the <composite... to <object..., but with no effect.

                I just noticed that anso's suggestion has corrupted my site. There's a bulkload of errors concerning the Articles-extra:
                (ERROR @ /index.php) Could not load class: ArticlesContainer from mysql.articlescontainer.

                Undoing the proposed changes and regenerating the schema didn't help to fix this.

                So now I'm faced with two problems: the modUser extension that' not working, and trying to fix my site...
                  • 38282
                  • 12 Posts
                  Okay, somehow the extension_packages-setting got corrupted, I've corrected it and the site is alive again, still no working modUser-extension though...
                    • 26903
                    • 1,336 Posts
                    Sorry my above post is corrupt for some reason what I meant was

                    add class="myLedenlijstLid" to the composite alias line and change your class name on your table to match.
                      Use MODx, or the cat gets it!
                      • 26903
                      • 1,336 Posts
                      Evidently for some reason I can'y paste into this thread so I'll type it :-

                      add 'class=myClassName' to your composite alias line and change the class name of your table to match.
                        Use MODx, or the cat gets it!