X-User


The X-User module is designed to provide additional features for the new user sign-up and registration system. It allows you to queue new users for approval before they are fully admitted, as well as customize the interface and exchange used during the registration process. X-User is not so much a replacement for the regular user system as it is an overlay that provides additional options and security.

The last release of X-User, version .2.3RC1, is found on the SourceForge website at http://sourceforge.net/projects/pn-xuser/, and it is also in the online book materials. An additional code hack is also available as a separate optional download. Installation of the module is fairly straightforward. The zip archive includes a root directory with the module's version in the name, so you need to unzip the file in a temporary location and move the contents of the xuser subdirectory into your site's modules folder. Proceed to the Modules Administration screen and activate the new module.

Settings

Return to the main Administration Menu and click on the new xuser link. There are three main areas in the X-User module. The first, Settings, provides options to customize exactly how PostNuke responds to prospective new users. You can see in Figure 23.3 how the email system, options at registration, and even the default group for new users are all manageable from the single form.

Figure 23.3. Changing how PostNuke responds to new users.


Five different policies can be applied to the registration process:

  • No Policy Users are allowed to register immediately.

  • User Activation Required New users are sent an email with an activation code. They must enter the code to verify their email address. This option prevents the need for new users to change the random password generated by PostNuke for new accounts.

  • Admin Approval Required New users are placed in a holding queue where an administrator must approve each before they are granted access. This is identical to the Submit News functionality.

  • Admin Approval Then User Activation After an administrator approves a new user, he is sent his activation code.

  • User Activation Then Admin Approval After a new user enters the activation code, he is placed in the waiting queue for approval.

The Server Can Send Mail? toggle lets X-User know whether it's possible to send Welcome and Rejection emails. Similarly, administrators can also receive copies of emails sent to users. This is especially useful for sites in which users are able to complete their activation without management intervention.

The next seven fields all manage how the registration interface looks. The Gender Flag, if enabled, requires the user to state her sex as part of the admission form. The Terms and Age Requirement drop-down list boxes not only let you toggle the agreements' appearance, but you can also make them separate pages that must be clicked through or integrated check boxes that are part of the main registration form (see Figure 23.4).

Figure 23.4. All your sign-up options in one simplified form.


Note

The minimum age used on this form is referenced from the PostNuke user system. It can be changed in the User Registration Configuration form under User Administration.


The minimum and maximum character counts for both usernames and passwords can be defined here, and they are validated upon submission of the form. Improper entries display an error prompting the user to correct the problem.

Finally, you can select the default group for new users. The list is generated from the groups you have created for your site. This is mainly used when users are automatically added to the PostNuke system. If you've chosen to approve each user, you have a select option at that time to decide which group they will be placed into.

Messages Customization

Click the Emails/Messages Customization link in the top navigation list to manage most of the text used by the module. You can see the initial configuration options in Figure 23.5. All of these fields are simply text areas that allow you to edit the messages X-User sends to users.

Figure 23.5. Managing new user communications.


This form has seven main sections:

  • Agreements Edits the wording used with regard to the terms and age verifications users must agree to. Additional fields allow you to define the uniform resource locators (URLs) to the separate agreement forms.

  • Welcome Mail Customizes the welcoming email message sent to new users.

  • Activation Mail Edits the phrasing of the email prompting users to use their included activation code to return to the site to complete their registration.

  • Send Password Mail Sends users this message when they request their password to be reset. This message includes a confirmation code.

  • Approved Mail Notifies users that their registration has been approved.

  • Rejected Mail Notifies users that their registration has been rejected.

  • Page Screens Customizes the messages displayed on various screens as part of the registration process.

Tip

All the other messages displayed by X-User but not part of the Message Customization page can be changed by editing the files found in /modules/xuser/pnlang/eng/.


Approval

The third administrative area is simply an approval table for users waiting in the queue (see Figure 23.6). From here, you can also sort users into different groups when their accounts are approved.

Figure 23.6. Approving users in the queue.


User Blocks

X-User also includes two unregistered user blocks (see Figure 23.7). They are installed as any other block. The User Functions block displays a list of links allowing users to request registration or fix their lost password. The User Login block is identical to the standard login block's functionality, but it is programmed to check with the X-User module before allowing login.

Figure 23.7. Using the X-User blocks to manage new users.


To properly set up the X-User system, you need to disable the default login block, and use this special login supplied by X-User. If you allow users to use the standard login block, the security provided by X-User is not effective.

Note

Both user blocks are only visible to site visitors who are not currently logged in. They are not visible to your administration account when you are adding them to your site.


Incoming Users Hack

This hack is documented in the optional incoming-xuser download. When completed, it adds the X-User new user queue to the Waiting Content feature of PostNuke. Open this file in your editor:

 /includes/blocks/menu.php 

Scroll down to roughly line 140. You will see a series of if blocks that check for and display queued content for Stories, Review, Web Links, Downloads, and so on. You can insert the X-User code between any of those blocks of code, but generally, you should list the users first, before content submissions. To that end, place the code just after the $header = 0; line and before the Stories::Story check like so:

 $header = 0; if (pnSecAuthAction(0, "xuser::", "::",ACCESS_ADD)) {     include_once("modules/xuser/pntables.php");     $pntable = array_merge($pntable, xuser_pntables());     $result = $dbconn->Execute("SELECT count(1) FROM $pntable[xuser] WHERE STATUS = -2");     if ($dbconn->ErrorNo() == 0) {         list($dnum) = $result->fields;         $result->Close();         if ($dnum) {             if ($header == 0) {                 $block['content'] .= addMenuStyledUrl($vars['style'], "<b>" . _WAITINGCONT. "</b>","", "");                 $header = 1;             }             $block['content'] .= addMenuStyledUrl($vars['style'], "New Users".": $dnum","index.php?module=xuser&type=admin&func=PendingAdminAV", "");             $content = 1;         }     } } if (pnSecAuthAction(0, "Stories::Story", "::", ACCESS_ADD)) { 

With that code added, you are notified of new users just like a story submission (see Figure 23.8). This addition works with any Menu block with the Waiting Content feature enabled.

Figure 23.8. Keeping track of new users with this easy hack.




    PostNuke Content Management
    PostNuke Content Management
    ISBN: 0672326868
    EAN: 2147483647
    Year: 2003
    Pages: 207
    Authors: Kevin Hatch

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net