We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5689
    • 289 Posts
    [This topic mainly regards Revolution, but Evolution is not out of the question.]

    As part of my quest to Revolutionize www.compeek.net (pun fully intended), I’ve realized that it would be useful to have an efficient, easy way to manage contacts that will be accessible via my contact form. This will also be useful for me in other projects, so I figure it’s worth investing the time in.

    On an Evolution site I’ve been working on for a client, I needed a quick way for the client to able to add/edit/remove contacts for the form I created for them using eForm. I couldn’t find a suitable way to do it with a module or anything, so I just created a bunch of child documents under the Contact Us page and made a few template variables. I then wrote a quick snippet to fetch each contact’s details (name, position, and email address) and set some placeholders to use in my eForm form and in the snippet call (specifically for the &to parameter. I used eForm’s eFormOnBeforeFormParse event to call my a function in my snippet. The end result was a pretty quick and dirty way for the client to be able to edit these contacts themselves and to have the contacts show up in a pull down box on the contact form, all without revealing any email addresses (for spam protection).

    The problem I have with this approach is that, in my opinion at least, MODx documents are meant to represent pages of the site. I realize they can serve a lot of purposes using template variables, but I’m just not satisfied with this approach because it doesn’t feel right. I also would really like some experience creating a component for Revolution, so I’m considering writing one.

    This component would connect to a database table to add/edit/remove contacts. It would provide an interface for the manager to manage the contacts. I would also create a snippet or two for generating lists of the contacts for use in contact forms. The fields I have in mind at the moment are id (a given, of course), name, job position, and email address.

    Does this seem like a good idea? What other fields might be critical for this if I created it?

    I appreciate any input, even if you want to say you think it’d be a waste of time. Thanks. laugh

    Edit: Some things I just thought of to include are IM screennames, and possibly a link to a MODx user (for example, if I’m the webmaster and I have a MODx user account, the contact entry for me would record my user id for automatically loading some of the fields, or something like that).
      I'm learning more about MODx all the time and loving it.
      • 3749
      • 24,544 Posts
      You might take a look at WebLoginPE which allows for user profiles with custom fields.
        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
        • 5689
        • 289 Posts
        That’s definitely an interesting snippet, but it seems to be overkill for what I’m trying to accomplish. It also wouldn’t be practical to use because not all of the contacts will have user accounts. For example, my church’s website (the site I mentioned I’m working on in Evolution) has maybe 7 or 8 contacts for the contact form, but only 3 or 4 of them will have user accounts.

        I’d really like something simple and efficient, but not underpowered, and I think it’d be a good way for me to learn MODx better.
          I'm learning more about MODx all the time and loving it.
          • 20413
          • 2,877 Posts
          Weblogin and the already built in Manager/Web User system in MODx... Did you install demo pages and
          tried it out?
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 5689
            • 289 Posts
            No, but I don’t think you’re understanding what I’m trying to do. This should have nothing to do with users and logins. I’m creating a way to basically store a few email addresses (and the name and position of the person belonging to each) so that I can retrieve them for a pull down box in a contact form.

            Maybe I’m missing something, but what you guys are suggesting is way to much for the simple task I’m trying to accomplish.

            To answer your question, mrhaw, no I don’t have the demo pages installed. For one thing, Revolution has no demo pages yet that I’m aware of, but I suppose I could go install Evolution with the sample content to see what you’re talking about. Does the official MODx demo site have Weblogin? I’ll go take a look.
              I'm learning more about MODx all the time and loving it.
              • 3749
              • 24,544 Posts
              We’re thinking that WebLoginPE would store the contact information for your "users" for you and make it easily retrievable with placeholders for use on your contact form. To create the info, you could have each of the contacts "register" as users (or do it for them). That would be just to get the data in and wouldn’t be repeated, nor would they ever log it -- you’d just have a convenient data store.

              If there aren’t that many of them, though, you might just as well use a document for each one with template variables for the fields. That’s the quickest and easiest and I don’t see any down side to it except that whoever enters the info will be exposed to the Manager.
                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
                • 20413
                • 2,877 Posts
                If using 0963/EVO:
                There is already installed tables and fields for "users" street, zip-code, e-mail etc. contact information in the database install of Evo to use.
                There is a bunch of snippets and existing code how to get this data and present it. And best of
                all you can edit it through the Manager without installing modules etc.

                But sure you could store the info in custom db tables, documents, tvs, chunks and use already existing code (e.g. getfield, eform2b, ditto)
                as well. But it’s not what I would do...

                //If installing demo-pages do it on a fresh install or it will wipe existing site!!
                The above suggestion by @BobRay is probably the most simple one ...in evo though, -Revolution is BETA.

                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 5689
                  • 289 Posts
                  Hmm. Okay. I understand what you’re saying, Bob. I suppose it makes sense to have a user for each contact. It still seems a little overkill, though. In this case, would WebLoginPE provide an easy way to get all of the users who qualify as a contact at once? Also, do you know offhand if WebLoginPE (or similar) has been updated to support Revolution?

                  I still don’t like the ideas of using documents because it as well seems kind of overkill and just doesn’t "feel right" to me (:P), but I suppose it’s not really worth writing a whole component to do what I can easily do otherwise.

                  mrhaw, thanks as well.

                  After reading both of your responses, I think it makes the most sense to have a user for each contact. In most cases, the contacts will all be part of the same organization anyway (I can think of an instance where some wouldn’t, but it’s not important to this discussion), so it doesn’t seem abstract to have them as users.
                    I'm learning more about MODx all the time and loving it.
                    • 3749
                    • 24,544 Posts
                    Quote from: Compeek at Jul 14, 2009, 06:14 PM

                    I still don’t like the ideas of using documents because it as well seems kind of overkill and just doesn’t "feel right" to me (:P), but I suppose it’s not really worth writing a whole component to do what I can easily do otherwise.

                    I know what you’re saying, but it’s fairly common to use documents to store information in MODx and many documents are never seen directly as a "web page." In many MODx ecommerce sites, each product is on a separate page. Once the pages are cached, there’s not that much strain on the server or the database when pulling them up.

                    I just looked and WebLoginPE is not available for Revolution yet.

                    I didn’t realize you were using Revo. I would suggest using a doc for each contact with a template variable for each data field and using the GetResources snippet (or a small custom snippet) to display them.
                      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
                      • 5689
                      • 289 Posts
                      Yeah, I’m on Revolution from the 2.0 branch of SVN.

                      I would suggest using a doc for each contact with a template variable for each data field and using the GetResources snippet (or a small custom snippet) to display them.
                      I’ll just do this then like I did in Evolution on the other site. Thanks for the ideas, though.
                        I'm learning more about MODx all the time and loving it.