MemberMgmt
(redirected from Cookbook.AcmeCMS)
Questions answered by this recipe
Answer: MemberMgmt is simple to use, and offers all the tools you want!
How it Works
Acme's ZAP forms processing engine can be used to create a powerful membership driven website. It's simple to install and setup. And because it works directly with AuthUser, it allows all the standard id: based password options available in PmWiki! Below are a few basic details to decide if MemberMgmt will do what you want, and then help you get started.
Downloads and extensive documentation (including dozens of code snippets) are available from the ZAP support site at www.zapsite.org. Please direct all questions/comments there, or to the PmWiki mailing list.
New Member Registration
Simply copy the Register form below to your wiki (feel free to add or remove profile fields as desired, and change the register field to match your changes). Fields Member and Password are both required. Member is automatically fixed to a proper page name format. If you are collecting email addresses, use field "Email" and it will be handled automatically in several special ways.
(:messages:) (:zapform:) (:zap datapage="Profiles.{$newmember}":) ||Member Name:%red%*%% ||(:input text Member:) ||Password:%red%*%% ||(:input password Password:) ||Real Name: ||(:input text RealName:) ||Email: ||(:input text Email:) ||Country: ||(:input text Country:) ||Gender: ||(:input select Gender Male:) (:input select Gender Female:) || ||(:input submit value="Create Account":) (:zap register="Email,Password,RealName,Country,Gender":) (:zap login="auto":) (:zapend:)
When the form is submitted various checks are made and a member page is created, in group Profiles (configurable). The password and email are encoded using ZAP's internal code mechanism and can only be decode by the individual member and/or an Admin. These pages do not need to be read protected, but can easily be restricted so users only see their own profile information if desired. Note, there are also many capabilities within ZAP for form validation, including required fields, and regex checks, etc. It is also possible to do email confirmation and many other things. The above form is just a sample to get you started.
Login
To create a login page, simply copy the form below to your wiki. It should work automatically. The login function automatically corrects invalid Member fields
(:messages:) (:zapform:) (:zap login="":) ||Member Name: ||(:input text Member:) ||Password: ||(:input password Password:) (:input submit value="Login!":) (:zapend:)
If desired, you can put a link at Site.AuthForm that points to your login form. Your login form can then be set to have the person logging in go straight to the page they requested once they login by setting the nextpage field to ZAP's {$ReturnLink} page variable. You can even set it to go that page in edit mode if desired, when they are attempting to edit a page--though it's a bit trickier.
If you wish to track member logins, see the LoggingPlus snippet for various ideas. Or use it to log new member registration, if you want to list for example the 10 newest members on your site. (You can also do this via pagelists).
Profiles
To give members the ability to update their profile information, create a ZAP form that updates the various data fields and put it in Profiles.GroupFooter. I use a conditional like this (:if equal {$AuthId} {$Name}:)
to only allow members to edit their own profile. To be a bit fancier, you could use the above to just give an update button, which when clicked, takes them an update form. The ShowHide recipe makes this even easier and looks quite sharp. Remember to encode their email and password!
Memberships
ZAP recently added a number of automatic group mgmt features to enable you to do some interesting things with your members. First, a "group" command allows you to add, remove, or reset entire groups with a simple form. (Groups in ZAP are defined in wiki pages in a configurable group called "Memberships"). These groups are automatically scanned by ZAP when a person logs in, and memberships are assigned and work exactly as if they were defined in Site.AuthUser.
In addition, the ZAP toolbox has a {(grouplist)} markup that allows you to display nicely formatted lists of group members, and two conditionals: a group_exists and a group_member (checks if a person is a member of a group). These capabilities allow you to do many interesting things with groups!
Site Customization
Once your member accounts are set up, it is easy to customize your site based on any profile information you have. Suppose you asked their favorite color when they registered. You could put something like this anywhere in your wiki:
(:table bgcolor={Profiles.{$AuthId}$:Color}:)
Or if you only wanted to show members who lived in Alaska a certain bit of text, try this:
(:if equal '{Profiles.{$AuthId}$:State}' 'Alaska':)I like Alaska!
There are many more possibilities of course. These just scratch the surface. Some other things that are quite easy to do when using ZAP for your CMS include the following:
- Create classes or groups, and organize special sections of your site for group members
- Create easy self-subscribing mailing lists for newsletters and/or member announcement
- Set up blogs, forums, instant messaging systems, etc, (with Hg, you can even allow one for each member!)
- Pull profile information into a config file and use it to let members choose custom skins
- Upload profile pictures and embed right in their profile page automatically
- Set choice of skins, etc by extracting the corresponding PTV in a config file
- Much, much more...
Feel free to let me know if you come up with some great ideas not listed here. If you can't figure out how to do something listed above, check out ZAPsite or post a question to the pmwiki_users mailing list. Or make a note in the comments section below.
Contributors
- Caveman Click here to learn more about the story behind this recipe...
- Many others who have suggested countless ideas along the way.
Comments
See discussion at MemberMgmt-Talk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.