- Drupal 7 Social Networking
- Michael Peacock
- 2891字
- 2025-02-21 01:31:55
Administering Drupal—An overview
Now that we have a basic understanding of how Drupal works, let's look through the administration area in more detail, making appropriate changes to settings where necessary to improve the suitability of our Drupal installation for a social networking site.
Note
It is important to note that the focus of this book is about using Drupal as a platform to create a social networking site. As a result, we won't be able to discuss each of the various features of Drupal in as much detail as deserved. We will of course cover everything that we need to, in sufficient detail, to use the features successfully for our social networking site.
Logging in
Before we can access Drupal's administrative tools, we need to log in as an administrator. The login box is on the left-hand side of our Drupal installation (http://localhost/drupal7/
). Let's log in with the user account we created during the installation process:

Once logged in, we have access to the administrative toolbar at the top, along with a bar of shortcuts which we can customize to provide links to the areas we frequently access:

Dashboard
The first option on the administrative toolbar is the Dashboard. This is a simple screen which lists any recent content in the site, any new users to the site, and provides a search form for administrators.

By default, the administration options in Drupal 7 appear in an overlay on the top of the main website, so that we can easily jump in and out of the administration area from the site itself.
We can customize the dashboard by clicking the Customize dashboard link, which allows us to configure the various blocks on the dashboard, move and reorder them, or select other blocks to add to our dashboard.
Let's add some more blocks to our dashboard:
- First click the Customize dashboard link. This presents us with a list of blocks currently on our dashboard, and the ability to add more blocks:
- From here, we can click Add other blocks to add more blocks to our dashboard.
As we are developing a social networking website, it would make sense for us to have the Recent comments block, showing recent comments which have been posted, and the Who's online block showing which users are online at the moment. This will give us, as administrators, a little more useful information from our dashboard:
- After making these changes, we need to click the Save blocks button at the bottom of the page:
Now, we have a slightly more useful and informative dashboard; or at least we will, once we have some users and comments on our site!

Content
The next section of the administration toolbar is Content, from here we can manage and create content for our site, and manage user contributed comments.
The main Content screen lists content in our site, and can be reordered by clicking the headings in the table listing the content. We can also select content and update its status, using the UPDATE OPTIONS drop down, or we can filter the list to only show content of a particular status or a particular type, using the options in the SHOW ONLY ITEMS WHERE section.

Content statuses
Content in Drupal can be given different statuses to determine how (or if) it should be displayed in the site itself. The statuses available are:
- Published: This indicates that the content is published, and where appropriate is visible through the site itself.
- Not published: This indicates that the content has either been disabled, or is currently in a draft stage, and isn't visible through the site itself.
- Promoted: Where appropriate, promoted content appears on the site's front page.
- Not promoted: This type of content isn't displayed on the site's front page; the visibility of not promoted content on the site depends on the "published" settings.
- Sticky: In pages which list or display a number of nodes, sticky content appears first. If for instance, we had a page listing health care tips for T-Rex dinosaurs, and the page listed content newest first, we could create sticky content which would always display at the top, to describe the listing in more detail.
- Not sticky: This type of content hasn't been marked as sticky; the visibility of non promoted content on the site depends on the "published" settings.
Creating content
To create new content for our site, we start by clicking the Add content link from the content section of the administration area. We are then presented with a list of types of content which we can create. By default, only Article and Basic page is available to us:

If we then select Basic page, we are presented with the appropriate screen to create a new page. There are two main aspects to the screen, the Title of the page, and the Body (or content) of the page. The Title is used as the name and the heading of the page, and the Body is the main content of the page:

When a content type forms part of a list (for example, if we create a page which lists all T-Rex pages) only a section of the content is displayed; the reader then has to click a read more link to read the rest of the page. The section of the page which is displayed is, by default, automatically trimmed from the page's content. However, we can click the Edit summary link to display a separate textbox which allows us to specify the summary of a page:

Finally, we have a number of different options and settings related to the new content, which we can configure, if we wish.
Each of the options down the left-hand side of the following screenshot are options which can be customized:

- Menu settings: This allows us to select if the page should appear in a menu, and if so, which menu and how it should be displayed.
- Revision information: This allows us to record a note when we create or change content, and select if the change should be saved as a new version of the content (which would allow us to undo changes at a later stage).
- URL Path settings: By default Drupal uses the ID (a number) of the node as the link to that page; we can create a more useful, readable URL to access the page by setting one in the URL alias box. In Chapter 3, User Content: Contributions, Forums, and Blogs, we will look at automating this process.
- Comment settings: Indicates if users can or cannot comment on a particular page (subject to the user's permissions).
- Authoring information: This allows us to change the author of the content (for example, if we are creating content on behalf of another user), and also the date that it was created.
- Publishing options: Here we can set if the content should be marked as Published, Promoted, or Sticky.
Comments
The COMMENTS tab allows us to view and manage comments which our users have posted on content within the site. Clicking the tab lists published comments, which shows the subject of the comment, the creator of the comment, where it was posted, when it was last updated, and allows us to view and edit the comment. The UPDATE OPTIONS drop down allows us to delete or unpublish comments. We can also click the Unapproved comments sub-tab to list any comments which are unapproved, so that we can moderate them and either approve or delete them:

Structure
The Structure section of the administration area deals with various components which make up our site's structure. This includes blocks of functionality and content displayed on the site, the types of content which make up the site, menus which allow users to navigate through the site, and taxonomy which allows us to categorize content within the site:

Blocks
Blocks allow us to place small sections of content or functionality in place across most of our site. For example, the location of a site-wide search box, or the user login box. The Blocks section allows us to reorder existing blocks, reposition them to different areas of the site, enable blocks which have been disabled, and create new blocks:

Blocks can be configured to specify which pages do or do not have the block displayed on them, which content types have the block displayed on them, which roles see the block, and if users can customize whether they see a particular block or not, all from the configure link next to each block. Blocks can be reordered by dragging the icon displayed next to the block's name, or be moved to a different section by changing the REGION drop-down list.
Tip
Struggling to reorder?
If you are struggling to reorder blocks using the drag-and-drop interface, you can click the Show row weights link, which will display a new column in the table listing the blocks. The column allows you to change the weight of a block, to make it appear higher or lower in the list. Block ordering won't be saved until you click the Save button, so remember to save any reordering before going into configuring or editing a block.
As there are quite a number of different locations that blocks can be placed, there is a helpful region demonstration which highlights on the screen which areas of the page match up to the region names.
A demo of these regions can be accessed by clicking the Demonstrate block regions link; such a demo is shown in the following screenshot:

While configuring the blocks, the first installed theme is selected, and not the default theme. This is an issue with Drupal itself, and should be resolved shortly.
Content types
The content types section lists all of the available types of content which can be created in our Drupal installation. As we have previously discussed, currently we can only create Articles and Basic page content elements:

For each content type we can edit them, manage the fields which can be entered when creating content of that type, manage how the content is displayed, and delete the content type. We can also create new content types from here. We will discuss creating and editing content types in more detail, later in this chapter, as it is a very important section in its own right.
Menus
Menus are used by visitors to our site to navigate through the content, pages, and features available to them. By default, there are four menus available (more can be created):
- Main menu: This is often used to show the primary sections of a site
- Management: This contains links for administrative tasks, and is used to generate the administration toolbar at the top of the page when logged in as an administrator
- Navigation: This is the main menu used to allow visitors to navigate through the site
- User menu: This menu contains user related links, including the my account link, and the logout link
From the Menus screen we can list the links associated with it, edit the menu, or add a link to the menu. We can also create new menus, and from the SETTINGS tab, we can reallocate menus to act as either the "Main links" or "Secondary links" menus within the site.

When listing the links for a menu, we can reorder the menu links using the icon next to the link name (or, by clicking Show row weights and manually changing the order for the links), enable or disable a menu link, edit menu links, delete menu links, and add new links to the menu:

Taxonomy
Taxonomy is a powerful feature within Drupal, it allows content to be categorized, which in turn makes it easier to group, list, and sort content within the site. Words, phrases, and terms are grouped into vocabularies. From the taxonomy screen you can create new vocabularies, and within each vocabulary you can create and manage terms associated with them:

Tip
A note to Drupal 6 users
Taxonomies have been completely reworked in Drupal 7. You no longer define which content types can be categorized by each vocabulary in the vocabulary settings; the only settings here are for name and description. Vocabulary is associated with content types through the content types themselves, thanks to the introduction of CCK to Drupal 7 core. We will discuss this in more detail later in the chapter.
Appearance
Themes which have been installed are accessible through the Appearance tab. By default, this tab lists all of the enabled themes we have installed:

Towards the bottom of the screen there is a section for specifying the ADMINISTRATION THEME. This allows us to have one theme for the public facing side of our Drupal installation, and another for the administration area. We can also opt to use the administration theme when we (administrators) create or edit content within our site:

There are a number of settings available for the themes installed, which can be accessed through the SETTINGS tab. These include the ability to enable or disable specific sections of the display, such as removing the Logo, or the Site name from the site's design:

People
The access details for users (visitors with a valid username and password) are managed through the People section of the administration area. This lists users within the site, and through the UPDATE OPTIONS, allows us to block or unblock particular user accounts, cancel a user's account, and assign or remove roles to a user account:

By editing a user account, we can change a user's username, reset their password, change their e-mail address, and modify their settings for using the site.
Permissions
Users, and administrators, are given permission to perform certain actions, such as creating content, commenting, performing searches, and so on, through the permission system. Each user is given a number of roles and these roles have permissions assigned to them.
The Permissions screen lists all of these permissions, with checkboxes showing which roles have permission to perform those actions. The permission allocations can be edited from this screen:

Roles
If we click the Roles sub-tab, we can see a list of the roles available in our site:

There are two locked roles, which we can't edit (though we can edit the permissions of them), these are anonymous user and authenticated user roles. The reason for this is that all users who access the site, who are not logged in, are regarded by Drupal as anonymous users. All users who are logged in are regarded as authenticated users (though they may have other roles too, to grant them more permission).
Modules
The Modules section lists all of the modules that we have available to use, which by default is all of the core modules. When we download new modules and extract the files into our Drupal folder, they show up in the Modules section, from where we can install them so that we can make use of their functionality:

Modules can be enabled or disabled, simply by ticking or unticking the box next to their name. Some modules require other modules to work, which is indicated by the Requires and Required by notes as part of the description.
Where appropriate, we can manage the permissions of a module by clicking the Permissions link next to it, which will take us to the appropriate modules' permissions within the permissions section of the administration area. If a module has configuration options, these can be altered through the Configure link.
Configuration
We looked at the important aspects of the Configuration tab in Chapter 1, Drupal and Social Networking. There are a number of areas of this section which we will need to alter throughout the course of this book; however it is best for us to wait until we need to, before we do that.
Reports
The Reports section provides useful information about our site:

From here we can view a Status report, which gives us an overview of our site, including various server settings, ensuring everything is configured to allow Drupal to run properly. There is an Available updates report which lists any modules or themes which may be out of date. As we are working with a version of Drupal we have recently downloaded, we should be all up to date!

It is important to check this regularly, to see if any modules have new releases, especially if there are security vulnerabilities which have been fixed in the new update. Updates to Drupal core are generally made clear throughout the administration area to ensure that we are up to date.