We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    Hi, I need to implement ClassExtender, and I want to talk myself through it and ask a couple questions before I get started. I know that if I do it wrong it will be a pain to clean up and try again, so I want to get this right. I also need to be clear how to integrate ClassExtender with my register form.

    For my purposes, I just need to attach data to my users, like location, age and so on. I don't need any hierarchical data or anything complicated.

    Ok so the steps of ClassExtender seem to be this:

    1. Install it
    2. Decide whether you want to modify the user or the classes (maybe both can be done but for now I only need one)
    3. Edit the proper file (ExtUserSchema or ExtResourceSchema depending on the answer to 2.)
    4. Open and view the appropriate resource (Extend modUser or Extend modResource)
    5. This makes the custom db.
    6. Then, customize the register form to include the proper field data, so that the user can input the data and it will go into the custom db.

    Ok I think that's it.

    Now my main question is about the register. In the ExtUserSchema we have these values:

            <field key="firstName" dbtype="varchar" precision="50" phptype="string" null="true"/>
            <field key="lastName" dbtype="varchar" precision="50" phptype="string" null="true"/>
            <field key="title" dbtype="varchar" precision="100" phptype="string" null="true"/>
            <field key="company" dbtype="varchar" precision="100" phptype="string" null="true"/>
            <field key="registrationDate" dbtype="datetime" phptype="datetime"/>


    And registration date is another issue, so let's ignore that. But the other values here are fine.

    Ok, let me grab my standard code from registration:

            <label for="password_confirm"> Confirm
                <span class="error">[[!+reg.error]]</span>
            </label>
            <input type="password" name="password_confirm" id="password_confirm" value="[[!+reg.password_confirm]]" />


    Now, in order to combine these two, I need to change the register to...this?
            <label for="title">Your Title
                <span class="error">[[!+reg.error]]</span>
            </label>
            <input name="title" value="[[!+reg.title]]" />


    And the last line is where all the juice is. Is it name or id or what?

    Maybe this info exists somewhere but I had trouble to find it. Do I still need to use the extended argument in my register call?

    After this I need to integrate some checkbox data into this as well.

    Thanks in advance. :-D

    This question has been answered by nuan88. See the first response.

      • 46886
      • 1,154 Posts
      Ah, I did just find this:

      [[!ExtUserUpdateProfile]]
      [[!UpdateProfile]]


      In order to get the data in there. So this means only on update rather than in register, I am fine with that.
      • discuss.answer
        • 46886
        • 1,154 Posts
        Ah! I found it! Its in the chunk ExtraUserFields and looks like this:

        <div class="x-form-item x-tab-item">
            <label class="x-form-item-label" style="width:auto; font-weight:bold; float:none; font-size:12px">Company</label>
        
            <div class="x-form-item x-tab-item">
                <input type="text" name="company" value="[[+company]]" class="x-form-text x-form-field"
                        onClick="Ext.getCmp('modx-panel-user').markDirty();"/>
            </div>
        </div>


        So when I integrate it, its just

         <label for="title">Your Title
                    <span class="error">[[!+reg.error]]</span>
                </label>
                <input type="text" name="title" value="[[+title]]" onClick="Ext.getCmp('modx-panel-user').markDirty();"/>