We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3186 ☆ A M B ☆
    • 279 Posts
    I have followed this tutorial to extend modUser

    http://rtfm.modx.com/display/revolution20/Extending+modUser

    kept in mind that the extension_package setting has a new format (modx version 2.0.6-pl)

    I have this structure;
    - core/components/extendeduser/model/extendeduser/mysql/

    with the ’sampleclass’ in my components root.

    After I added the snippet and try to get the service (as shown in example), the $x var contains a boolean false. The error log shows me

    [2011-02-28 09:28:35] (ERROR @ /~bert/modx-cms/Atkins.com/src/index.php) Could not load class: Sampleclass from sampleclass.
    [2011-02-28 09:28:35] (ERROR @ /~bert/modx-cms/Atkins.com/src/index.php) Problem getting service extendeduser, instance of class Sampleclass, from path /home/bert/public_html/modx-cms/Atkins.com/src/core/components/extendeduser/
    [2011-02-28 09:28:35] (ERROR @ /~bert/modx-cms/Atkins.com/src/index.php) [Extendeduser] Could not load Extendeduser class.

    Does extending modUser works anyway? Has anyone expriance with this?

    Regards, Bert
      MODX Ambassador (NL) & Professional MODX developer
      Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
      MODX e-commerce solution SimpleCart
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Are you trying to add custom fields that are associated with a given user? Do you have custom database tables that are keyed off of the MODx user id? If so, did you run a script to generate the necessary class files?
        • 26568
        • 30 Posts
        In doc http://rtfm.modx.com/display/revolution20/Extending+modUser
        For fully functional applications please refer to Currenty available extended modUser classes.
        How to get this samples? I has try but authorization requiring to access linked page...

        Another Question, I followed by manual, when I calling getService to get extended user instance
        	        
        $this->shooters = $this->modx->getService(
          'extendeduser',
          'ShootersHelper', 
          $this->modx->getOption('core_path', null, MODX_CORE_PATH).'components/extendeduser/', 
          $this->config);
        


        Error occured:
        [2011-03-09 16:31:10] (ERROR @ /index.php) Problem getting service extendeduser, instance of class ShootersHelper, from path /home/user1/public_html/dev/core/components/extendeduser/
        


        Any ideas what can be wrong ?
          • 26568
          • 30 Posts
          Maybe somebody have working example ?
            • 22303 MODX Staff
            • 10,725 Posts
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              I’ve done this, but what I did was pretty involved due to what the application needed, so I’m not sure if it’ll be applicable to you... I was doing this all via xPDO and creating custom database tables.
                • 26568
                • 30 Posts
                Hi again, here a lot of time passed, i have return to extending user profile, above issue with package including seems resolved
                packages = Array (
                    [om] => Array
                        (
                            [path] => /home/shootpau/public_html/dev/core/xpdo/
                            [prefix] => modx_
                        )
                
                    [modx] => Array
                        (
                            [path] => /home/shootpau/public_html/dev/core/model/
                            [prefix] => modx_
                        )
                
                    [extendeduser] => Array
                        (
                            [path] => /home/shootpau/public_html/dev/extra/extendeduser/core/components/extendeduser/model/
                            [prefix] => sp_
                        )
                
                )
                

                but now have another problems with subject.
                So, from manual http://rtfm.modx.com/display/revolution20/Extending+modUser
                $this->userObj = $this->modx->getObject('modUser', $this->_config['userID']);
                $this->userID = $this->userObj->get('id');
                


                As I see userObj after that is modUser instance but how to get my extended user, from the manual i Can’t understand, can anyone help ?
                I tried to follow manual and get my extended profile info in described way
                $this->userObj = $this->modx->getObject('modUser', $this->_config['userID']);
                $this->userID = $this->userObj->get('id');
                $shooter = $this->userObj->getOne('Shooter'); // $shooter is null
                $shooter = $this->userObj->Shooter; //  $shooter is null
                
                $classKey = $this->userObj->get('class_key'); // $classKey is 'modUser'
                


                Model map generated based on schema
                <?xml version="1.0" encoding="UTF-8"?>
                <model package="extendeduser" baseClass="xPDOObject" tablePrefix="sp_" platform="mysql" defaultEngine="MyISAM" version="1.1">
                    <!-- inherit the modx user and extend it -->
                    <object class="extUser" table="users" extends="modUser">
                        <composite alias="Shooter" local="id" foreign="userId" cardinality="one" owner="local" />
                    </object>
                    
                	<object table="shooters" extends="xPDOSimpleObject">
                		<field key="userId" dbtype="int" precision="11" phptype="integer" null="false" />
                		<field key="shoots" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
                		<field key="payments" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
                		<field key="summary" dbtype="decimal" precision="2,0" phptype="float" null="false" default="0" />
                		<aggregate alias="extUser" local="userId" foreign="id" cardinality="one" owner="foreign" />
                	</object>
                </model>
                  • 26903
                  • 1,336 Posts
                  Try <object class = "Shooter" table="shooters" ......
                    Use MODx, or the cat gets it!