Setting Up Access Control


Figure 10.1 shows the Content module being edited. To get here, simply go to the Administration menu, click Modules, and then find the module you want to edit. Click its Edit link (in the right column of the modules list), and you'll see something like this screen.

Figure 10.1. Editing a module.


You can see that you can restrict any single module to registered users, subscribers, or administrators, or you can throw open the module to all visitors. Setting up your site's access from this point is fairly straightforward, with one notable exception.

The News module is the default home page for a PHP-Nuke Web site, and whichever module is in the home cannot be restricted. So if you plan to put lots of stories into the News module and you want to force users to register before reading them, you can't have the News module in your home page. You'll have to select a different module for the home.

This is a quandary for some Webmasters. It was for me when I was building www.scriptinganswers.com: I wanted the latest news stories to be listed on the home page, but I wanted you to have to register before you could read the whole story. So I had to get someone to make me a custom module I named Homepage, which lists the articles. That module is available to all visitors. Clicking on a headline takes you into the News module, which is restricted; you can see in Figure 10.2 what happens when an unregistered user (or a registered user who hasn't logged in) tries to read one of the news stories.

Figure 10.2. Access denied!


This message is generated automagically by PHP-Nuke because I have the News module set up to allow only registered users. PHP-Nuke realized that the current user wasn't logged in and displayed this message when he tried to access the News module.

So give some thought to how you want people accessing your site, and then configure PHP-Nuke accordingly. Don't forget that you can configure block visibility the same way; you probably don't want a Forums block shown to all visitors if the Forums module itself is restricted to registered users. On the other hand, you might want it to be visible: The block might serve as a teaser for the forums. But users might be confused when they see a block that, when they click on it, tells them "Access Denied."



    PHP-Nuke Garage
    PHP-Nuke Garage
    ISBN: 0131855166
    EAN: 2147483647
    Year: 2006
    Pages: 235
    Authors: Don Jones

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