We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26388
    • 103 Posts
    I've installed the package and followed the documentation http://bobsguides.com/classextender-class.html However, once I complete the process I can no longer login. I get the following message:

    The username or password you entered is incorrect. Please check the username, re-type the password, and try again.

    I've done each step in the guide and have emptied the browser cache as well as removed all files in the core/cache directory - reloaded the page and still cannot login. The only way I can login back in, is if I change my user class_key back to modUser.

    I am working on this using the latest version of Modx 2.2.14.

    Can anyone shed some light on why this is happening? What's missing in the guide or what am I missing? [ed. note: scitekmike last edited this post 12 years, 3 months ago.]
      • 26388
      • 103 Posts
      Update: I changed the class_key back to modUser, logged in and checked the error log.. this is what I found:

      [2014-06-05 11:05:11] (ERROR @ /index.php) Could not load class: extUser from mysql.extuser.
      [2014-06-05 11:05:33] (ERROR @ /manager/index.php) Could not load class: extUser from mysql.extuser.

      Why would it not be able to load the class? The plugin is active..
        • 3749
        • 24,544 Posts
        The plugin doesn't load the class, it's loaded because of the value set in the extension_packages System Setting. Can you check to see if there's a reference there to the extuser package?

        Do you have the latest version of ClassExtender?
          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
          • 26388
          • 103 Posts
          Hi Bob,

          First, thanks for replying.

          It is the latest version of ClassExtender as far as I know. I installed it via the package management interface today. Looking through and doing a search on the system settings, I don't have anything for extention_packages in the core settings. If I select classextender, there are no settings as well.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Then you don't have it. There are two ways to do this; the best way is to create a snippet with this (or perhaps all in lower case?):
            <?php
            $modx->addExtensionPackage('extUser','[[++core_path]]components/extUser/model/');
            return;


            Or you can manually add the setting:
            Key: extension_packages
            Name: setting_extension_packages
            Description: setting_extension_packages_desc
            Field Type: Textfield
            Namespace: core
            Area Lexicon Entry: system
            Value: [{"extuser":{"path":"[[++core_path]]components/extuser/model/"}}]
              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
              • 3749
              • 24,544 Posts
              Note the spelling: extension_packages wink

              You should see something like this:

              [{"extendeduser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}}]
                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
                • 26388
                • 103 Posts
                Oops. Well regardless I have no system setting in there for extension_packages. I manually added one it using both you suggestions and still does not work. Still seeing this error in the log:

                [2014-06-06 09:52:27] (ERROR @ /manager/index.php) Could not load class: extUser from mysql.extuser

                Current system setting:

                Key: extension_packages
                Name: setting_extension_packages
                Namespace: core
                Area Lexicon Entry: system
                Value: [{"extUser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}}]

                Technically, if I look where the php files are in the core/components/classextender/model/

                There are two more directories in that model folder:

                core/components/classextender/model/classextender
                core/components/classextender/model/schema

                With that shouldn't the path to the class file should be:?

                [{"extUser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/classextender/"}}]
                  • 26388
                  • 103 Posts
                  Ok, finally got it working by doing the following:

                  Added the Extension Packages system setting by using the snippet script:

                  <?php
                  $modx->addExtensionPackage('extUser','[[++core_path]]components/extUser/model/');
                  return;
                  


                  Then updated the value of the system setting with what Bob noted above:

                  [{"extendeduser":{"tablePrefix":"ext_","path":"[[++core_path]]components/classextender/model/"}}]


                  Then, I re-ran the snippet form that was installed with classExtender per the documentation:

                  Extend modUser
                  1st not updating the class
                  2nd updating the class

                  Reloaded the manager and checked my user account.. the example fields are all there and the manager is functioning as expected.

                  Thank you both for the insight and additional information.

                  Suggestion: the information regarding the system setting I think is a big hole in the guide/documentation. It should be stated somewhere in the guide that setting needs to exist *before* you run the form. I'm assuming that the package classExtender when you install it should automatically create that system setting. However, if it doesn't and that setting is missing it creates a wealth of headache trying to understand why it's not working.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I don't think that setting exists until something creates it. On one site, I installed Gallery and that site does have it, with an entry for Gallery.
                      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
                      • 3749
                      • 24,544 Posts
                      This is very strange. ClassExtender calls addExtensionPackage(), which contains this code:

                      $setting = $this->getObject('modSystemSetting',array(
                                  'key' => 'extension_packages',
                              ));
                      if (empty($setting)) {
                         $setting = $this->newObject('modSystemSetting');
                         $setting->set('key','extension_packages');
                         $setting->set('namespace','core');
                         $setting->set('xtype','textfield');
                         $setting->set('area','system');
                      }
                      
                      /* ... */
                      
                      return $setting->save();
                      


                      So clearly the System Setting is supposed to be created if necessary. You should never have to create the setting or set it yourself. I'll have to check further to see if I can figure out what's going on.

                        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