We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4429
    • 429 Posts
    i have been asked to do some work on a trade magazine site.

    The site needs to have a registration/login for trade users only.

    The only way to ensure that the users are genuine trade users is to have manual approval of the registrations. These would need to go to a specified email address and be approved by an admin clicking on a particular link.

    Is this easily done in modx?
      • 25663 MODX Staff
      • 12,272 Posts
      Sure. Just use the WebloginPE snippet.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4429
        • 429 Posts
        I’m looking at this now.

        http://www.sottwell.com/assets/snippets/webloginpe/docs/parameters.html

        I cannot see where the admin can manually approve registrations. The options appear to be instant registration and verify i.e the user verifies their e-mail address, but that is all.

        I’m trying not to be lazy but if you could point me in the right direction that would be great.

        Thanks
          • 4018
          • 1,131 Posts
          Hi there,

          Ok, first of all, there’s a Google Code site setup for managing the latest versions of WebLoginPE:

          http://code.google.com/p/webloginpe/

          Really should update the entry in the Extras section to point to that page. Time to add another thing to my to-do’s. wink

          The latest version has support for a new "pending" option for the regType param. I’ll give you a quick rundown with a simple example of how it works:

          For the first part, you’ll need to make some adjustments for the signup page. Here’s a basic snippet call for it:

          [!WebLoginPE? &type=`register` &regType=`pending` &registerTpl=`registerForm` &notifyTpl=`notifyMessage` &regSuccessId=`2`  &regSuccessPause=`0` &notify=`[email protected]`!]


          The type is set to ’register’ with the regType set to ’pending’. That part is pretty straightforward. The main difference between the pending regType and activate regType is that no email is sent to the user yet and the user is created in a ’pending’ state.

          You’ll also need to create a new webuser group called ’Pending Users’. If you don’t like the name you can specify what group or groups with the pendingGroups. This can be a comma delimited set of group names if more than one webuser group is required.

          You can use the same registerTpl form in the documentation for the registration form.

          The notifyTpl param allows you to set the message that is sent whenever a user registers with the notify param set to the email addresses to send the message to. If you look at the snippet code, you’ll notice there’s also an optional notifySubject param for setting the subject of the notification email.

          With that set, you should be able to fill in the form and, upon submit, a new webuser will be created and set to the appropriate webuser group and an email should be sent out with a notification of a new user.

          The last bit will require you to create a page that allows administrators to approve pending users. It’s probably a good idea to make sure that this page is secured for only certain webusers. Here’s the basic call:

          [!WebLoginPE? &type=`manager` &activateId=`2` &groupsField=`usergroup` &usersList=`The following accounts require approval:default:default:username:ASC:webgroup(Pending Users)`!]


          The type is set to manager which, just like in the documentation, defaults to allowing you to view and edit all the users. However, in this case, we’re gonna do a few other things.

          First, we’re gonna set the usersList field so that only users that have the webgroup set to ’Pending Users’ are shown. The usersList param works pretty much the way the documentation says.

          Second, we’ll set the ID of the page we’re using to allow users to activate their account. This is necessary because, unlike the ’activate’ regType, the user hasn’t received an activation email yet. This param is what tells the script what page to send in the activation email that is created when you approve a user.

          Lastly, you’ll need to tell the script what field to use for the groupsField param. Basically, you’ll need to set your own manageProfileTpl chunk and add a dropdown, set of radio buttons, or checkboxes that allow you to choose what usergroup (or usergroups) to add the user to. Works pretty much like any other custom field in WebLoginPE.

          You’ll also need to make one modification to the default manageProfileTpl form. Switch out the default submit button with this one:

          <button type="submit" id="wlpeApproveUserButton" name="service" value="approveuser">Submit</button>


          This will tell the script to use the ’approveuser’ function instead of the ’saveuser’ function. Basically, it’ll save the user but will send the user a notification telling them how to activate their account.

          And, that’s about it. Might have left out a detail or two but that’s the basics nonetheless. laugh

          Jeff
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
            • 4429
            • 429 Posts
            Quote from: Bravado at Oct 21, 2009, 04:33 PM



            [!WebLoginPE? &type=`manager` &activateId=`2` &groupsField=`usergroup` &usersList=`The following accounts require approval:default:default:username:ASC:webgroup(Pending Users)`!]



            Lastly, you’ll need to tell the script what field to use for the groupsField param. Basically, you’ll need to set your own manageProfileTpl chunk and add a dropdown, set of radio buttons, or checkboxes that allow you to choose what usergroup (or usergroups) to add the user to. Works pretty much like any other custom field in WebLoginPE.




            Jeff,

            Could clarify that last bit please?

            You said the groups field works like any custom parameter so I did the following:

            I added this to the snippet call:
            &customFields=`usergroup`
            &inputHandler=`Select User Type:usergroup:usergroup:select:Business Member(Business Members)`


            And added this to the manageprofile template:
            <label for="usergroup" id="usergrouplabel">Select User Type
                <select id="usergroup" name="usergroup">
                    <option value="Business Members">Business Member</option>
                   
                </select>
            </label>


            This doesn’t seem to work though.

            Any help would be appreciated

            Thanks



            Edit:

            Tried adding this to my call on manager admin page but it throws up a database error:

            &customTable=`web_users` &customFields=`web_group` &inputHandler=`Approve user:userGroup:web_group:select:Pending(1),Approved(2)`
              • 31640
              • 100 Posts
              hi, first of all, WebLoginPE is really great.

              i am using it on a website i am creating, the basic login, register, logout stuff works great,
              but there is still one requirement that i need to implement because it’s crucial for the customer and that is....
              the manual approval for new registrations grin

              so i hope a working exemple will be posted here...

                • 4429
                • 429 Posts
                Just realised that in my setup of this, the user is still recieving an email upon registraion i.e before they are approved.
                  • 4018
                  • 1,131 Posts
                  Actually, you don’t have to specify the field with the customFields and inputHandler options. I think the only reason you’d want to use the customFields and inputHandler options is if you want to have WebLoginPE insert in the form input dynamically. Honestly, I haven’t done this so I’m not sure what the logistics of it are. The only thing you need to make sure of is that your form includes a way to select the usergroup you want to add the user to. The groupsField option tells WebLoginPE which input to use when the form is submitted:

                  &groupsField=`usergroup` 


                  You also need to make sure that WebLoginPE is only listing the users that require approval:

                  &usersList=`The following accounts require approval:default:default:username:ASC:webgroup(Pending Users)`


                  The usersList option allows you to filter the list of users shown. In this case we’re filtering the list to only show users where the webgroup field is set to ’Pending Users’.

                  You also have to make sure that you’ve updated the Save button. The submit button has to have a value of ’approveuser’:

                  <button type="submit" id="wlpeApproveUserButton" name="service" value="approveuser">Submit</button>


                  Regarding the email notifications, did you set the WebLoginPE call with the correct type, regtype and notify params?

                  [!WebLoginPE? &type=`register` &regType=`pending` &registerTpl=`registerForm` &notifyTpl=`notifyMessage` &regSuccessId=`2`  &regSuccessPause=`0` &notify=`[email protected]`!]
                    Jeff Whitfield

                    "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                    • 4429
                    • 429 Posts
                    Hi thanks for the reply. This is my current registration call. As you can see it is set to ’pending’.

                    [!WebLoginPE? &type=`register` &regType=`pending` &registerTpl=`registerForm` &notifyTpl=`notifyMessage` &regSuccessId=`53` &groups=`Pending Users` &regSuccessPause=`0` &notify=`[email protected]` &customFields=`fullname, gender, username, email, address, city, zip, state, country, phone, fax, business_type, subscriber`  &inputHandler=`Tick this box if you currently subscribe:userSubscriber:subscriber:checkbox:()||Business Type:userBusiness:business_type:select:Distributor(distributor),Manufacturer(manufacturer),Media(Media),Retailer(retailer),Trade Organisation(trade_organisation),Wholesaler(wholesaler)` !]


                    I get an email when a new user registers - but at the same time the new user gets an email with their login details, even though their account is still pending.

                    I created a page all User Approval and set the call as you said:
                    &usersList=`The following accounts require approval:default:default:username:ASC:webgroup(Pending Users)`

                    This shows me all the users who are still pending.

                    I also changed the submit button when the admin views pending users profiles to:
                    <button type="submit" id="wlpeApproveUserButton" name="service" value="approveuser">Submit</button>


                    My only issue is how I to make it so the when I click submit it moves the user into the group ’Business Members’ - Where and how should I use the &groupsField=`usergroup` In in the profile template? - how? - should user group be set to ’Business Members
                      • 19094
                      • 9 Posts
                      Nice work! Did you manage to get the last part finished?