Planning User Access to Stories and Topics


User access isn't a problem if you want your stories to be available to all users, including anonymous ones, who visit your site. However, getting users to register for access to your site may be crucial to the way your site operates. For example, you may want users to register so that you can capture their e-mail addresses and send them a monthly e-newsletter; you may want them to register so that you can track their visits more readily and use that demographic information appropriately. Whatever your reasons, planning user access to stories can be particularly difficult.

The News module creates most of the difficulty because it's usually the module you place in your home page, meaning it can't be restricted to just registered users. Unfortunately, the News module is also the module used to view all stories. That makes for a simple equation: If the News module is in the home page, you can't restrict access to stories.

There are ways around that restriction, however. For example, take a look at Figure 42.1. Here, I've used the Modules administration to place the Topics module in the home page rather than the News module.

Figure 42.1. Placing the Topics module in the home page.


As you can see, the home page still displays messages at the top; that's a function of the home page itself, not the News module that used to live in the home page. Underneath is a list of all my site's topics and the most recent stories for each topic. This provides access to the content in a fashion similar to the News module, but in a somewhat more organized list. The most recent stories are displayed, which, to me, is the important thing.

Now that the News module isn't in the home page, I can restrict it, as shown in Figure 42.2, making it available only to registered users of my site. This doesn't affect the list of stories in the Topics module, but remember my short structural lesson: The Topics module just lists stories; it links to the News module to display those stories. If an anonymous user visits my site, that user sees the home page shown in Figure 42.1; if he clicks on a story, however, he sees Figure 42.3, which denies access to the now-restricted News module and encourages the user to register for an account.

Figure 42.2. Restricting the News module.


Figure 42.3. Access denied: The News module is now restricted.


You might also put a completely different module in the home page, although I don't recommend doing so. News stories are too easily ignored, and they typically represent an important part of your site, so having them listed in the home page is a key element.

Another trick for restricting News access is to make a copy of the entire News module folder (in the Modules folder of your site) and simply rename it. Call it News_Home or something. Put that module in your home page, and then restrict access to the original News module. Your home page will contain the original News module's display of the most recent stories, but users who click the Read More link will be taken to the original News module, which you've restricted.



    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