Using WebLoginPE
WebLoginPE is an enhanced version of the original front-end user management scripts, WebLogin. As ScottyDelicious put it, it's WebLogin, Progressively Enhanced. We called it Web Login Pirate Edition!
First a bit of history (at least from my point of view). I needed to build a website in four languages with front-end user validation, and some custom database work. The database work is another story, covered here and here. This was many years ago, back in the days when MODx was just a set of extensions to the Etomite CMS. Etomite had a simple enough structure that it was trivial to build the four-language version, but... it lacked the front-end user management that I required. Regretfully, I began searching through the free/OSS CMS offerings again. Then a Google search landed me right back on the Etomite forums again, this time in the section for the MODx extensions. Bingo! The site is still going strong after two redisigns and several upgrades of the MODx core.
The web user management system consisted of a few extra scripts in the core, along with a few modifications to the existing core functions, and a snippet to handle the front-end login/logout. As time passed, front-end registration was added to the mix. But it was still limited to the fields that were originally available, which were simply a mirror of the manager user system; or at least it was very awkward to add custom fields, and even more awkward to get them back out again. There is a table called "web_user_settings" that can be used for custom data. But it consists of three fields; one for the user ID (webuser), one for the setting name (setting_name), and one for the setting value (setting_value). So if you want to add a company name to the user profile, you need a query like this:
INSERT INTO modx_web_user_settings (webuser, setting_name, setting_value)
VALUES ($id, 'Company Name', '$companyname')
Try loading the fields from a registration form or a profile editing form into this table, without creating duplicate rows in the database. Supposing you have more - lots more! - custom settings. It gets ugly fast; you have to get all the rows for the web user, then generate an array using the setting_name as the key and setting_value as the value. Bleah. Gives me a headache just to think about it. Doable, but definitely not fun.
So, ScottyDelicious took on the project of designing a new front-end system, without doing anything drastic to the MODx core. The results is WebLoginPE - Progressively Enhanced (I like Pirate Edition better!).
From the Inside
The guts of WebLoginPE resides in the webloginpe.class.php file. As the filename suggests, it's a class. This means it's quite possible to extend, expand and otherwise customize it simply by extending the class. However, the existing class is so comprehensive and flexible it's unlikely that anyone would ever really need to go to that extreme.
The main concept to understand about wlpe is that of "services". There are several types of pages generated, such as login/logout, registration, management, profile and users. Each of these types make use of various services to provide the required functionality. For a comprehensive look at these types and services, there is documentation provided in the "docs" directory of the webloginpe. While this is excellent documentation as far as it goes, there is no actual "How do I do ... ". This series of articles will attempt to fill that gap, with explanations and working examples. Feel free to log in to the Manager of this site (username "guest", password "guestuser") and look at the actual snippet calls and chunk used.
Modifications
Since it was originally written and released, in the best spirit of Open Source, a number of people have taken the time and effort to expand on and improve the original code. Numerous bugs have been fixed. The latest version available from the MODx Extras is the result of this community effort.
There is a board on the MODx forums dedicated to WebLoginPE.
Active development is organized as a Google Code project.
Exploring WebLoginPE
Each of the following articles will explore one of WebLoginPE's modes of operations, or types.