
上QQ阅读APP看书,第一时间看更新
This recipe details the steps involved in toggling block visibility based on which type of user is viewing the page. For example, a block displaying advertisements might only need to be visible for anonymous users and not for authenticated users.
For this recipe, we will be configuring the welcome message block which we created in an earlier recipe in this chapter, to only be visible to authenticated users.
Controlling block visibility is handled from the block administration pages as outlined in the following:
- Navigate to
admin/build/block
(Home | Administer | Site building | Blocks). - Locate the block which needs to be configured—the
Welcome message
block—and click on the Configure link next to it. - On the configure screen, scroll down to Role specific visibility settings.
- Check the box corresponding to the authenticated user role which should have access to the block.
- Click on the Save block button at the bottom of the page to save the changes.