Book Image

Drupal 7 Social Networking

Book Image

Drupal 7 Social Networking

Overview of this book

Drupal is ideally equipped to serve as a base system for creating a custom social networking site like Facebook or MySpace. While these large social networks have their place, niche social networking websites can help promote businesses, products, projects, and hobbies of any nature. Drupal 7 Social Networking provides careful instructions and clear explanations to take you through the setup and management of your social network site, covering topics from users, to marketing, to maintenance. It will help you create your own social networking site, suitable for whatever audience you choose! Starting from the very basics of both Drupal and Social Networking, right through to more complicated aspects, you will progressively learn how to add to and expand your social networking site and add more features. You will learn how to secure your social network, deploy it on the Internet, and keep it running and well maintained. As social networking sites rely on the participation of their users, this book helps you to structure your site in such a way so that users can easily and enjoyably contribute, thus creating a powerful social network.
Table of Contents (22 chapters)
Drupal 7 Social Networking
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Installing Drupal


We know what Drupal is, we know what social networking is, and we know what we are going to create with Drupal throughout the course of this book; let's get started! The first thing we need to do is install Drupal. This section contains some detailed technical information regarding the requirements and installation of Drupal.

Note

For most of the book, we will be working with Drupal installed locally on our own computers (see Appendix A, for setting up a development environment if you don't have web server software installed on your own computer). As we build up the site we will then deploy Drupal onto a web server in Chapter 10, Deploying and Maintaining our Social Network.

Requirements

Provided we used the instructions in Appendix A to set up our development environment, we will already have a suitable development environment which meets the minimum requirements to run Drupal. For reference, or if you are using a custom development environment and want to check if it meets the requirements for Drupal, the minimum requirements are:

  • A web server:

    • Apache 2.0 or greater is recommended

  • PHP 5.2.4 or greater.

  • Database engine: Either MySQL 5.0.15 (or greater), MariaDB 5.1.44 (or greater), PostgreSQL 8.3 (or greater) or SQLite 3.4.2 (or greater). MySQL is assumed during the course of this book.

  • To make use of friendly or clean URLs, the mod_rewrite module for Apache, and the ability to use .htaccess files is required. However, this is optional.

  • PHP's XML extension may be required to utilize certain XML-based services using Drupal. This is also optional.

The Drupal Handbook also has a page on installation and usage requirements; however this page is currently for several versions of Drupal, with accompanying notes, and is marked as requiring an update: http://drupal.org/requirements.

Download

We can download Drupal from the download page, http://drupal.org/download. This page contains download links for Drupal Core, Installation Profiles, Themes, Translations, and Modules. We want to download Drupal core:

Installation

Now that we have downloaded a copy of Drupal 7, we need to install it on our local web server, to do that we need to:

  • Extract the Drupal files

  • Create a database

  • Run the Drupal installer

Extracting the Drupal files

The file we have downloaded is a compressed file containing all of the individual files which make up Drupal. We need to extract this into the web folder in our development environment (see Appendix A) using an unzipping program (such as WinZip, PowerArchiver, or Windows, built in "Compressed folders" system, or the default program for handling compressed files on your computer).

Tip

Technical installation details

Further details on these requirements are available in the INSTALL.txt file in the Drupal download zip.

Creating the database

We need a database for Drupal to use to store information such as the website's content, details of our users, settings, and so on. PHPMyAdmin is a web-based tool for administering MySQL databases; most web hosts provide access to it, and we have a copy on our local machine too.

Let's log in to phpMyAdmin and create our database, our local installation is located at http://localhost/phpmyadmin/. We will need to have our database username and password available (see Appendix A, if you are using that development environment). Most of the development environment software, such as WAMP, XAMPP, and so on have a default username of root without a password.

Once logged in, we have the option to create a new database, let's call it drupal, by entering it into the Create new database box:

Note

Keep a note of the database name, as well as the database username and password, as we will need them in a minute when we run the Drupal installer.

Running the Drupal installer

Now we have our database, we can run the installer; to do that we just need to visit the folder where we extracted Drupal, using our web browser. This should be http://localhost/drupal/.

Since we haven't installed Drupal yet, visiting this page will take us straight to the installer, which initially asks us if we wish to install the Standard (with the most commonly used features pre-configured) or Minimal (with only a few modules enabled) installations.

  1. Select an installation profile: Let's select Standard, and then click the Save and continue button:

  2. Choose a language: Next, we need to select the language we want to install Drupal in. The default download only includes English, though additional languages can be downloaded from Drupal.org, so we can click the Save and continue button again:

    Drupal will then automatically verify the development server against the installation requirements; as we are using a suitable development environment, this won't raise any issues for us.

  3. Database configuration: We are then presented with the Set up database screen where we can enter the name of the database we created earlier, drupal, and the username and password (working locally, the default WAMP installation gives us a username of root with no password) required to access that database:

    Once we have entered that, we again click Save and continue.

  4. Drupal installer: Now the installer gets to work:

  5. Configure the site: The final step in the installation process is for us to provide some basic configuration information, including the Site name, Site e-mail address, details for a maintenance account, server country and time zone, and update notifications.

    We need to supply the site name, DinoSpace!, and e-mail address, so that our site has a name, and all site e-mails come from a site related e-mail address. The site maintenance account will be our initial administrative user account; it is important that we use a secure username and password:

    The SERVER SETTINGS indicate the country to be used for the site, and the default time zone for dates and times displayed on the site. Finally, we can select to have our Drupal installation automatically check for updates and send notifications to us:

    Once we have completed this page, we click Save and continue.

  6. Installation complete: Our installation is now complete; the final screen confirms this for us, and provides us a link to view the newly installed Drupal site:

    If we click that link, we see our new site, and we are automatically logged in:

Configuring Drupal

We will discuss Drupal's administrative options more in Chapter 2, Preparing Drupal for a Social Networking Site; however, now that we have installed Drupal let's look at configuring our installation.

Provided we are logged in as an administrator, the administration bar is at the top of the page, listing the main administrative sections available. Click the Configuration option:

This then presents us with a pop up window overlay within our browser, containing the administration options available:

Let's go through these, focusing on the ones important to us for initially configuring our site.

People: Account settings

Here the first group of settings is for ANONYMOUS USERS; this has a setting Name, which is the name given to users who have not logged into the site, but who are interacting with the site. Any content that they create will be created under this name. Let's leave this as Anonymous:

The next group of settings is ADMINISTRATOR ROLE, the role for administrative users. Within Drupal, users have a number of roles within the site (such as administrator, editor, reviewer, and so on) and these roles have various permissions assigned to them. When new modules are installed, the administrator would automatically have full permissions for these modules; by selecting or changing the Administrator role here, we can change which role will automatically receive these permissions when new modules are installed. Let's leave this setting as administrator.

Next we have REGISTRATION AND CANCELLATION, which defines who can register for a user account, if these accounts require e-mail validation, and what happens in the event of an account cancellation. Since we will want lots of visitors to sign up to DinoSpace! we should configure it so that Visitors are selected under Who can register accounts?. To prevent automated SPAM accounts registering and posting SPAM content, we should require all visitors to verify their e-mail account before they are able to log in.

Finally, we should leave it so that when accounts are disabled, the content created by that user is retained on the site. If we changed this, various pages, comments, and discussion posts would be removed when a user cancels their account.

The next section, PERSONALIZATION, allows us to provide some brief personalization options for our users, such as allowing them to upload pictures and use e-mail signatures. Let's enable signatures so that our users can have a custom piece of text added after their posts on the website, and add picture guidelines requesting that our users only upload photos that they are permitted to upload, and that are within the guidelines of our site:

The final group of options here allows us to customize the text of any of the user account related e-mails which Drupal sends out:

We should leave the e-mail options as they are and click Save configuration.

System: Site information

After clicking Save configuration from the e-mail settings, the site information can be found under the Configuration menu. The first group of settings under site information is SITE DETAILS, this includes the Site name and E-mail address, which we set when we installed Drupal, and also the site's slogan, so we need to add that in here:

The next group of settings, FRONT PAGE, define which page should act as the front page, and how many posts should be displayed on that page. This isn't something we are ready to change yet, as we don't have any content, so we can leave that as it is:

The final group of settings relate to ERROR PAGES, and which pages should be used for the default 403 and 404 error pages. Again, we don't have content in place for these pages, so for now, we should leave them as they are. Once we have created pages to act as the error pages, we simply add the pages' URLs into the appropriate boxes:

Other configuration options

The other configuration options are not immediately important to us, however now is a good time for us to take a look at what these settings do.

People: IP address blocking

This setting allows us to list a number of IP addresses, the Internet addresses assigned to computers, which we want to block from using our site. If we find that we are receiving troublesome posts from one particular user or SPAM account, we can block their access to the site. This isn't foolproof, as IP addresses can be spoofed to appear to be different, or the user could request a renewed IP address from their Internet Service Provider.

System: Actions

This allows us to define and manage actions within our site.

System: Cron

Certain tasks, such as bulk mailings or search indexing, need to be processed on a regular basis automatically. The cron settings allow us to manually run these tasks, and configure how frequently they should be run.

Content authoring: Text formats

From here we can configure types of formatting that we wish to enable in our site, and the types of users who are permitted to use that content. For example, allowing users to post full HTML could pose a security risk, and only administrators should be permitted to post that. Other users would be allowed to post a restricted sub-set of HTML tags with their posts.

User interface: Shortcuts

Allows us to manage shortcuts to commonly accessed areas of the administration section.

Media: File system

This section indicates where files are uploaded to, and the servers temporary folder; these are automatically set from the installation process.

Media: Image styles

This section allows us to group various image effects (resizing, cropping, and so on) together, for use by other features and modules.

Media: Image toolkit

By default, since we are using the GD image library, this allows us to set the default image quality for uploaded images; this is a compromise between image quality and file size.

Development: Performance

Various options to help with the speed and performance of our site are managed within this section. By default, Drupal caches (keeps its own copy, preventing the need for it to continually lookup or load it) certain information, which keeps things running fast. Sometimes, we may need to turn off caching or clear the cache so that new options and changes we apply (for example, adding a new template) can take effect.

Development: Logging and errors

This allows us to define which types of errors should be logged, and how many of these logs should be kept.

Development: Maintenance mode

This allows us to turn our website off, placing it into maintenance mode, and displaying a message to our users.

Search and metadata: Search settings

This contains various settings related to the search feature.

Search and metadata: URL aliases

This allows us to "map" one web address onto another, for instance, creating a shortcut link to a long URL to promote on marketing materials.

Search and metadata: Clean URLs

This allows us to enable or disable the use of Clean URLs in our site. Clean URLs convert URLs which make use of the query string (?path=node/) to ones which don't, making them cleaner and more user friendly.

Web Services: RSS publishing

This allows us to customize our default RSS feed, which is a list of publicly visible content that visitors can read through their favorite feed reader.

Regional and language: Regional settings

Time zone and locale settings related to our site and server; this is the default time zone and location information which is used when generating times or regional specific language or symbols.

Regional and language: Date and time

The format which dates and times should be displayed on the site, when they are used in long, medium, and short forms.