Drupal Basics: Be a Role Model
by Jamar Bibbs
July 08, 2009
|
This week we're going to delve into Roles, and how you can use
them to create limitations and extra priveleges for your
site's users.
|
In our previous articles, we've shown you how to install
Drupal on your web server, we've shown you what Modules are
and what they can do for you, and we've discussed how you
can change the look and feel of your site using Themes. This
week we're going to delve into Roles, and how you can use
them to create limitations and extra priveleges for your
site's users.
By default, Drupal creates two Roles upon installation:
anonymous user and authenticated user. The anonymous user
role is just that--when a user visits your site and they
have not registered, or are not logged in, they are limited
to anonymous user status and the restrictions that are
associated with that role. They may not see all the menus,
or use many or none of the features of your site--that is,
until they log in. Once they are logged in, they assume the
Role of authenticated user, and gain all the priveleges
associated with being a logged in, i.e. authenticated user.
They may be able to user more or all of the features of your
site, they may be presented with a different theme or menu,
and they may have access to do things like upload images,
create blogs, or post comments on other stories.
You may wonder why Drupal provides you with the ability to
create additional roles. First, you may want to create
different user roles for your site, such as Artists, Fans
and Subscribers. You may wish for your Artist members to be
able to upload audio tracks of their own music, along with
videos of themselves. You may also want your Fan members to
be able to listen to those music tracks, and view those
videos, and perhaps comment on them, but not allow them to
upload audio or videos themselves. Then you may wish to
allow members from either group to become a subscriber,
(perhaps using the Paypal
module), and those members would have additional
features available to them, such as access to Artists
personal blogs, or exclusive access to their latest
releases, concert news, etc.
Drupal makes that all easy. You just go to Administer ->
User Management -> Roles, and at the bottom of the list of
current Roles, you type in the name of the new Role, such as
Artist, and click the Add Role button. You will then be
taken back to the Role page, where you can click the Edit
link, which allows you to change the permissions for your
new Role (i.e. grant the new role specific permissions, such
as the ability to upload images, etc.).
Role Permissions also enable you to allow, or disallow,
specific Roles to edit their own entries, or perhaps the
Role is an admin of sorts, and you can enable that Role to
edit not only their own content, but content that has been
submitted by other Roles or you could even provide them with
the same permissions that you, as admin, have from default.
Another additional benefit of using Roles is that you can
create content of just about any sort (Book, Story, Blog,
Audio, Video, Image, you name it), and enable that content
to be seen, or not seen, based on the Role of the member
that is on the site. So all of the Artists on our site would
see a message from the site's admin telling them about a new
feature available to all Artists, while Fans would see an
altogether different message, and Subscribers could not only
be presented with a different message, but they could be
viewing the site that uses a different Theme that other
users are seeing, with a different layout, different
sections, different options. Very nice!
There is a very nice little video on Creating
Roles that comes from an excellent site for Drupal
aficionados that is appropriately called Drupal Dude.
Now you have set up your first Drupal installation, you've
added and enabled some Modules, added and enabled your
site's Themes, and you've created some Roles and set
specific permissions! Next time we're going to show you how
to enable your site's members to upload audio and videos to
your site, including videos from YouTube and Google!
Core Modules
Drupal Basics
|