We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21872
    • 95 Posts
    Is there a way to add this field to the manager UI? I know it exists, and I know rtfm says it is not used in the UI, but since it does exist (and I happen to need an easy way to add profile photos) I was wondering if there’s a way to create an interface for it? I’m concerned that, assuming I work out how to add this field to the UI, I’d be hacking core files which would then be overwritten on the next update. Any suggestions?

    Thank you.
      • 3749
      • 24,544 Posts
      The photo field is varchar(255) so it will hold the URL of the photo, not the photo itself.

      You should be able to add it to the User Profile editing page without hacking any core code at all.

      You’ll want a plugin tied to OnUserFormRender and OnUserFormSave.

      Since the photo field is already there, you won’t even have mess with extended fields.

      In a plugin tied to OnUserFormRender, this code will add a new field (in this case for a tree_root_id setting):

      $fields = '<div class="x-form-item x-tab-item">
                <label class="x-form-item-label" style="width:152px;"><b>Tree Root</b></label>
                <div class="x-form-element">
                    <input type="text" name="TreeRoot" value="'. $v .'" class="x-form-text x-form-field" />
                </div>
            </div>';
            $modx->event->output($fields);
      


      I think the hard part will be implementing the photo upload part of the form.
        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
        • 21872
        • 95 Posts
        Hm. I wonder if I can use an unused TV to handle the image upload and selection -- something similar to how Bruno17 does his multi-items grid?
          • 3749
          • 24,544 Posts
          Quote from: nsfdev at Jan 17, 2011, 03:18 PM

          Hm. I wonder if I can use an unused TV to handle the image upload and selection -- something similar to how Bruno17 does his multi-items grid?

          You’d want the the path to each users image in his or her own profile, and the TVs are normally only available when editing a resource. I guess if each user has a home page, they could upload the TV there (in the Manager) and a plugin could set the image url in the user’s profile. I think that would be much easier than customizing the user profile form, but you’d have to let all the users access the Manager, which would be a problem on some sites.

          If it was me, I think I’d submit adding the user photo to the user profile form as a request and just wait for it -- but then I’m lazy. wink
            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