WebLoginPE

This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.

WebLoginPE is a progressively enhanced (PE), advanced web user management snippet for Evo. WebLoginPE manages user registration, activation, login, logout, password recovery, extended profiling, profile editing, viewing and contacting other users, and user profile removal.

WebLoginPE started off as a rewrite of the Evo weblogin snippet so I could make an AJAX login for my site.

WebLoginPE is easy to setup and use, but extremely customizable. You can let WebLoginPE provide the forms and display templates for every view the user might see, or you can use a chunk to customize ANY view. If you are so inclined, you can manage how WebLoginPE will handle selects, radios and checkboxes so that the user's choice is remembered and already selected/checked when they view or edit their profile.

WebLoginPE strives to be standards compliant. The default forms and views are valid XHTML 1.1, however, you can create your own forms and views to use with WebLoginPE in any format you like. WebLoginPE provides the processing and the basic structure. You can use CSS and JavaScript to enhance your forms and views any way you can imagine. Even the sky is no limit for what you can do.

The latest version can always be downloaded from the Repository.

Installation/Upgrade

New Installation
  1. Upload the "webloginpe" folder and all it's contents to /assets/snippets/ in your Evo installation.

  2. Log into the Evo admin interface.

  3. Go to "Resources" => "Manage Resources" => "snippets" and click "New snippet"

  4. Give this snippet a name of WebLoginPE and a description of <strong>1.2.0</strong> A progressively enhanced, complete Web User management snippet.

  5. Open the file "webloginpe.snippet.php" and copy it's contents to the "Snippet code" area back in the admin interface.

  6. Save the snippet.

Upgrade from 1.0 - 1.2.0
  1. Upload "webloginpe.class.php", "webloginpe.templates.php", the "js" folder, the "lang" folder and the "Default Forms" folder to "/assets/snippets/webloginpe" in your Evo installation and OVERWRITE or REPLACE the existing files.

  2. Paste the NEW contents of webloginpe.snippets.php into the existing WebLoginPE snippet as described above in "New Installation".

How might you actually use WebLoginPE?

Simplest Example

You can run WebLoginPE using the simplest function call:

[!WebLoginPE? &type=`simple`!]

You can do this to test whether the Snippet and its functions are working. Simply place that Snippet call on a page and preview the page; try logging in and updating your profile. It won't be pretty, but it should work. If you have trouble, take a look at the WebLoginPE Errors.

Use a Login Page

The following wireframe outlines a site where you have a dedicated page with the login form. This example uses all of the default templates with all the default fields.

  • You need to create a new Web User Group : go to Security => Web Permissions => Web User groups. In this example, I created a user group named "Logged In Users", you will reference this in the "&groups" parameter (I think the image references the wrong group name).

  • You need to create a Document Group, don't go anywhere! Still in the Web access permissions area of the manager, create a new document group, e.g. "Private Pages".

  • Associate the User Group with the Document Group - still in the web access permissions area, go to the User / Document group links and make sure the user group and the document group are associated.

  • You need to create 7 pages:

1. The page containing the login form. It should contain a call to the WebLoginPE snippet (contained in one line):

[!WebLoginPE?
&type=`simple`
&liHomeId=`2`
&regHomeId=`3`
&profileHomeId=`4`
&loHomeId=`6`
!]

2. The Welcome page. This is the page users see after logging in. It should belong to a special user group, e.g. "Private Pages" -- that way it is not publicly available. 3. Registration page. This should contain a call to the WebLoginPE snippet using the &type=`register` parameter:

[!WebLoginPE?
&type=`register`
&regSuccessId=`5`
&regSuccessPause=`1`
&groups=`Logged In Users`
!]

4. Profile page. Belongs to the "Private Pages" group so it's not publicly accessible. The Snippet call looks like this:

[!WebLoginPE?
&type=`profile`
!]

5. Registration success page. This contains a message seen after a user registers. If you emailed the user a password, then the page should say that. It should also contain a link back to the login page.

6. Goodbye page. This is the page that users see after logging out. It can contain links back to the rest of the site.

7. You should also create a designated HTTP 500 page. This is the page that is shown if a public user tries to view a private page. Create the page, preferably with a link back to the login page, and be sure to denote it in the control panel under Tools => Configuration => Site under "Unauthorized page".

Strengths and Limitations

This setup is simple to understand (ha… relatively speaking), so it's easier to debug and it helps you get a feel for how these pieces work together. However, it has the following limitations:

  1. it uses only the default forms (none of the template chunks are used for customized forms)

  2. it doesn't use the more common layout where the login appears in a sidebar.

  3. The link to the login page will always say "login", even when the user is already logged in. No dynamic handling of this link is presented in this wireframe.

Types

This list includes options you add to WebLoginPE's &type parameter.

simple

[!WebLoginPE?
&type=`simple`
!]

This is the simplest to use, but as for understanding what's going on under the hood, this is the most complex option because all 4 functions (login, register, profile, logout) are encapsulated in a single page and are triggered by the value passed in the "service" variable (i.e. the value in $_POST['service']). Links between the different "pages" are automatically generated.

By default, the page shows a login form (or a welcome message if user is already logged in). It has links (buttons) to Login, Forgot Password, Register.

Email Verification; Profile Editing

You first need a place where a visitor to your site can register to become a web user.

The registration page should contain a call to the Snippet:

[!WebLoginPE?
&type=`register`
&regType=`verify`
!]

Note that the form does not require a user to enter a name; only email and username are required by default. The fullname field can be blank. If you want to require the fullname field, use the ®Required parameter:

[!WebLoginPE?
&type=`register`
&regType=`verify`
&regRequired=`username`
!]

But this configuration lacks a logout button.

Basic Initial Set-up

On your Home Page or Site Template, put the Snippet call like

[!WebLoginPE?
&type=`simple`
!]

where you would like the Login Box to appear.

Create a New Page called Registration, and put a Snippet call like

[!WebLoginPE?
&type=`register`
!]

Create a New Page called Profile, and put a Snippet call like

[!WebLoginPE?
&type=`profile`
!]

You can customise each of these snippet calls, by adding parameters (see the Documentation in the download package), for example on your Registration Page, you could specify

[!WebLoginPE?
&type=`register`
&groups=`Pending Users`
&notify=`me@mydomain.com`
&regSuccessId=`74`
&regSuccessPause=`3`
!]

to make new registrations be assigned to the Pending Users group, an email notification sent to me@mydomain.com, user will be taken to success page (page ID is 74), and pause for 3 seconds.

 

Suggest an edit to this page.