We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    I am a long time Evo user and am now switching to Revo...

    I am building a university alumni group site.

    Most of the pages on this site will be public. One main page, lets call it CONTACTS, will be a container page that presents aggregated child pages for each person. All these child pages will just be contact "cards" with user names and email information. There will be no links or access to these child pages, just a CSS styled grid to display all the user contacts on the main CONTACTS page. I decided to use child pages in this manner because I could use a TV system to enter all the information. It will then be easy to add and delete members in the future. I am using the Getresources snippet for this.

    I need the CONTACTS page to be private. There will be a visible link to the CONTACTS page in the main navigation system. What I want is is a request for a username and password to appear when the viewer clicks on the CONTACTS link.

    For now the number of members in the CONTACTS page will be around 80 or so, but that might swell to a few hundred. Initially I think it will be ok to have one general username and password that will be shared by all members in the CONTACTS system. All this page does is show names and emails. I want this to be simple and easy for everyone, without showing the contact information on a public visible page. There could come a time when this membership decides that having just one username and password for the entire group is not satisfactory. In that case we would need to assign individual usernames and passwords for each and every member.

    What is the best way of doing this? This will all be front end stuff: no access to the backend MODx Manager, etc.

    Thanks!
      • 3749
      • 24,544 Posts
      Max, have you considered putting all the user info in the user profile and not having a resource for each member. Then you could use either User Management to update the user info or let users update their own contact info either in the Manager or in the front end using the UpdateProfile snippet.

      The Peoples snippet is sort of getResources for Users. It would create the display on the contact page.

      In terms of architecture, is seems to make more sense to me to think of contacts as users rather than resources, unless you will be having an actual page for each user and letting the user update it (a la Facebook).

      Hiding the Contacts page from prying eyes is just a matter of putting it in a resource group and connecting that resource group to a user group with a Resource Group Access ACL entry. Once you do that, only members of that user group will be able to see it.
        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
        • 23299
        • 1,161 Posts
        Thanks Bob.

        I will check into this People's snippet.

        I did take a quick look at user management but so far it looks really complicated in Revo? I am on the road and will take a slower, more careful look after the holiday.

        I want all of this contact info (each person) to be visible to the entire group, just so long as they have the required username and password. Having just one username and password for the entire group carries some risk but I want this to be as simple for everyone as possible. I would prefer to avoid registration, usernames and passwords for each person.


          • 23299
          • 1,161 Posts
          The other thing I want to do is add custom CSS to the presentation of all the contacts? I was planning on having these "contact cards" floated across in rows using three columns...
            • 23299
            • 1,161 Posts
            Couple of things as I try to wrap my head around this...

            I read most of Bob's Revo security page stuff here: http://bobsguides.com/revo-security-tutorials.html

            I followed most of this and I created a system of users, a user group, a user role, a resource group, and some access policy choices. This seems like a very complicated mix of moving parts with all these elements needing to be connected just so.

            Anyway, I have a couple of pages saved as "private pages", via a role. When viewed from the front end the link to these pages in the navigation bar are gone. If I uncheck the access box when editing the page the link to the page will now appear in the navigation. What I want is for the link to always appear in the navigation. When the user clicks on the link I want a message saying please enter your username and password before allowing the contents of the "private pages" to show.

            So far I have not installed or activated any login snippet. Do I need to do so to achieve what I want?

            I tried the Peoples snippet like Bob suggests. It will aggregate a list of user names from a group but it will only present names. I want a custom field, email address and home town to be listed as well...

            Any thoughts?

            Thanks!
              • 4172
              • 5,888 Posts
              As far I know wayfinder doesn't list private resources, if the user hasn't permission to list them.


              I tried the Peoples snippet like Bob suggests. It will aggregate a list of user names from a group but it will only present names. I want a custom field, email address and home town to be listed as well...
              with peoples you can output any user-fields by using &tpl.
              http://rtfm.modx.com/display/ADDON/Peoples.Peoples.tpl

                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 3749
                • 24,544 Posts
                I think if you put a tag for the Profile snippet in the Tpl chunk used by Peoples, it will do what you want.

                As for controlling access, I think you might want to leave the pages unprotected and use a snippet at the top of the page that forwards users to the Login page (with &redirectToPrior in the Login tag).
                The snippet would look something like this:

                [[!CheckStatus]]



                <?php
                /* CheckStatus snippet */
                
                $loginId = 12; /* Set to Id of Login Page */
                
                if (! $modx->user->hasSessionContext('web')) {
                    /* make sure referer is set so &redirectToPrior will work */
                    $_SERVER['HTTP_REFERER'] = $modx->makeUrl($modx->resource->get('id'),"","", "full));
                
                    /* forward user to login page */
                    $modx->sendRedirect('$modx->makeUrl($loginId, "", "", "full"));
                }


                If you need to check membership in a specific user group, you can use this test:

                if (! $modx->user->isMember('SomeGroupName')) {
                
                }


                [ed. note: BobRay last edited this post 14 years, 9 months ago.]
                  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
                  • 23299
                  • 1,161 Posts
                  Thanks guys!

                  I fiddled around with this some more. I decided to try adding a login feature. Looks like the Login snippet is the weapon of choice here. I ran it and added the four extra resources as described in the docs.

                  Now, once I have a user identity logged in the private page links now appear in the main navigation. This is not totally what I want but I think it will do if I add the link to the login page nicely.

                  Next comes deciding how I tackle presenting all the user "contact cards". My original intent was to create a parent container page that would aggregate all the contact cards. I can add what I want and style them with custom CSS. Bob's suggestion of not using resources but rather use a list of Users from the security pane is interesting. I want to control the passed presentation and control what parts of the User identity fields get presented. I want Name, Year started, Email Address, Home Town and State.
                    • 3749
                    • 24,544 Posts
                    I think those could all be shoehorned into the user profile -- that would be the most efficient. If so, the Profile snippet would display them for you. If not, you could put the extras in extended user fields so that the Profile snippet could show 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
                      • 23299
                      • 1,161 Posts
                      Thanks Bob. I am making progress.

                      I have created a Tpl chunk for Peoples. I am using the default name of pplUser and it works mostly so far.

                      Here is the code for the chunk:
                      <ul class="brotherCard">
                      <li class="name">[[+fullname]]</li>
                      <li>[[+email]]</li>
                      <li>[[+city]]</li>
                      <li>[[+state]]</li>
                      </ul>
                      
                      


                      The front end page now aggregates this simple list. It pulls in the name, email address, city and state from each user I have added to this user group. Success! I would like to create some custom field that I could add as well. I guess I need to figure out how to add a custom entry field in the User > General Information pane? How would add something like "Year Started"?

                      [ed. note: Photowebmax last edited this post 14 years, 9 months ago.]