Professional Documents
Culture Documents
Published 2011 by Acquia, Inc. 25 Corporate Drive, 4th Floor Burlington, MA 01803
Editor: Heather James This manual is partially based on material developed by Zivtech http://zivtech.com/ Acknowledgements Screenshots of the case study websites are used with generous permission of their respective trademark owners. We kindly thank Varnish Software http://www.varnish-software.com/ for use of screenshots of their site. We kindly thank openSource.com, a Red Hat community service, for use of screenshots of their site. Red Hat and the Shadowman logo are trademarks of Red Hat, Inc., registered in the United States and other countries. The copyright of all information contained in the screenshots of http://styleguide.yahoo.com/ is owned by Yahoo, Inc. We kindly thank Yahoo, Inc for permission to use their site styleguide.yahoo.com as a case study. The copyright of all information contained in the screenshots of www.london.gov.uk is owned by the Greater London Authority. We kindly thank the Greater London Authority for permission to use their site london.gov.uk as a case study.
Feedback
Your feedback is much appreciated. Please dont forget to tell us about your experience. http:// www.acquia.com/training-feedback
Appendix
Please download the PDF full appendices available at http://tinyurl.com/trainingappendix
Drupal 7 in a Day
Table of contents Course overview and welcome to Drupal!" Before we get started" Session 1: What is Drupal?"
Unit 1.1 - Drupal's strengths" Unit 1.2 - Whats in the box? Take an administration tour" Unit 1.3 - Common modules and conguration" Unit 1.4 - Installing modules" Session discussion"
3 7 8
8 8 17 21 25
27
27 32 37 40 48
49
49 57 61 64 67
68
68 73 78 79
80
Drupal 7 in a Day
Navigate the administration area to manage essential tasks. Congure and set up a basic Drupal site. Select, install and congure modules from Drupal.org Create content and congure content types. Manage user roles and accounts. Create listings of content Manage aliases and URL paths. Create blocks and place them in the layout Selecting, installing and conguring contributed themes from Drupal.org. Check your site thoroughly before going live.
All through Site Building that is, selecting and conguring a variety of modules.
What to expect
Presentations, demonstration or discussion at the start of each session and unit. Exercises where you practice what youre learning. Challenges stretch your skills. If you have additional time, try the exercises and activities marked Challenge. You can also try to apply some of the activities to ideas relevant to your own work. This will help you come up with good questions to answer throughout the course. Tips advice about ways to speed things up, where to go next, recommendations for modules to check out. Summary and review - each unit and session has some thoughts for review.
3
Drupal 7 in a Day
Administration menu http://drupal.org/project/admin_menu Advanced Help http://drupal.org/project/advanced_help Busy http://drupal.org/project/busy Calendar http://drupal.org/project/calendar Chaos tools http://drupal.org/project/ctools Google Analytics http://drupal.org/project/google_analytics Masquerade http://drupal.org/project/masquerade Pathauto http://drupal.org/project/pathauto Token http://drupal.org/project/token Views http://drupal.org/project/views Webform http://drupal.org/project/webform
Chaos Tools with Page manager http://drupal.org/project/ctools Allows a site manager to control the layout of specic pages. Content Access http://drupal.org/project/content_access Global Redirect http://drupal.org/project/globalredirect Imagecache Proles http://drupal.org/project/imagecache_proles LoginToboggan http://drupal.org/project/logintoboggan Mollom http://drupal.org/project/mollom Permission select http://drupal.org/project/permission_select Quicktabs http://drupal.org/project/quicktabs Revisioning http://drupal.org/project/revisioning Rules http://drupal.org/project/rules Site Map http://drupal.org/project/site_map Twitter http://drupal.org/project/twitter Views Bulk Operations http://drupal.org/project/views_bulk_operations Varnish http://drupal.org/project/varnish
4
Drupal 7 in a Day
Views Bulk Operations (VBO) http://drupal.org/project/views_bulk_operations Views Slideshow http://drupal.org/project/views_slideshow Workbench http://drupal.org/project/workbench XML Sitemap http://drupal.org/project/xmlsitemap
Distributions mentioned:
Drupal Commons http://commons.acquia.com/ COD - Conference Organizing Distribution http://usecod.com/ OpenScholar http://scholar.harvard.edu/ (demo) Open Atrium http://openatrium Open Publish http://openpublishapp.com/
Drupal 7 in a Day
Schedule
Depending on your venue, timings may differ. These are only guidelines based on a schedule from 9-4:30pm. While sessions may run longer or shorter, keep track of the break time. Its really important to take breaks, get away from the computers, and stretch, especially in the afternoon! We start with a broad overview and tour, and get successively deeper into each aspect of Drupal as the day continues. Start Duration On arrival 9:30 9:30 0:30 1:00 Session Before we start Introduction Session 1 Description Prepare for the class by thinking of some good questions.
Get set up Why choose Drupal? Who makes Drupal? What's in the box? A hands-on tour
What is Drupal
10:30 10:45
0:15 1:15
Break Session 2
Modeling data and content types Users and roles Customizing content administration
12:00 1:00
1:00 1:30
Lunch Session 3
Content display with Views Information architecture (Paths, URLs) Block placement and layout Navigation
2:30 2:45
0:15 1:00
Break Session 4
Modules: Can Drupal do X? Themes: How your site looks Distributions and Installation proles
3:45
0:45
Session 5
You have a new client! Apply what you learned in a new situation
Drupal 7 in a Day
Select a few details to inspect closely and come up with some specic questions here are some examples below. Make note of your questions on a blank page of this manual.
Consider functionality: What kind of functionality does the site offer you as a visitor? Can you login? What additional abilities do you have? How can you interact with the site? Consider content: Can you see portions of the content, such as a title or summary on one page, with a link to a full page? How is the content displayed? Consider the navigation and layout: How do the menus and areas of the pages divide content and attract your attention? How did they arrange the content in the areas on the pages? How did they manage the menus? Consider the look of the site: How is the overall design unied? How does the use of graphics or colors make the site pleasing and unique?
As a review at the end of this course, come back to the sites you identied to see if you can answer your own questions!
Drupal 7 in a Day
Organize and display content. Customize site appearance. Manage routine tasks such as site registrations. Manage users by individual accounts and by roles such as members. Apply granular administrative and content permissions.
The Drupal framework is open-source, and therefore the source code behind it is available to anyone interested in modifying or developing it further. Drupal has grown in leaps and bounds over the last few years powering everything from small blogs to Whitehouse.gov. This growth is due in part to Drupals unique strengths, which include:
Community Drupal is supported by a vibrant and talented development community. Custom content types and elds the ability to build and modify content types. Taxonomy provides unlimited, multilevel categorization of content. Views controls how lists and tables of content are displayed. Caching Drupal's caching tools greatly enhance page load times. SEO friendliness - Drupal's clean URLs feature packs a mighty SEO punch.
Drupal 7 in a Day
You are logged in as the superuser also known by the alias user/1. As this superuser you have access to all the controls to customize your website.
The overlay can be turned on and off for different kinds of users. By default all of the administrative functions are performed in the overlay. This is provides a consistent administration experience for all Drupal 7 sites, and makes a clear separation between what visitors see and what site administrators see. You can also turn off the overlay entirely, and change the look of the admin area. The admin bar shows the top-level categories of all admin functions on the site. A user will only see those options that they have access too. The shortcut bar can be customized and different sets can be created. Users only see links they have access to. Note that the save button in Drupal is located at the bottom of each page usually!
Were about to take a whirlwind tour through all of the main sections of the Drupal administration area. This is going to go by pretty fast. Keep in mind, were going to dig deep into each of these sections throughout this course- so do keep track of some of your burning questions.
The shortcut bar can be customized. You dont need to make user-specic menus. Drupal is rather clever about menus. Users will only see the links to functionality they have access to. Meaning, if you added a link to Date and time settings, only administrators with the right privileges could see the link. 1. Click Edit shortcuts to manually add links. 2. As you browse click a + sign in a particular section to add a link to the bar.
9
Drupal 7 in a Day
By altering the shortcut defaults you can create a new Shortcut set. Users can choose from a variety of shortcut set options, or be allowed to create their own. To give the correct permissions at Navigate to People > Permissions > Shortcut Select any shortcut set.
Dashboard
The tour starts at the Dashboard. This is a quick-start area for users of your site. What links a user sees are limited by the users permissions. This means it will automatically generate a user-role specic dashboard. You can drag and drop blocks into the Dashboard.
Content
This section will show a list of added content. In the section tabs, you can also locate comments. Keep an eye out for additional tabs that appear here as you extend your site with modules.
Title: What not to pack Image: If you have an image you can upload one. Tags: travel tips, packing Body: Fill in some sample text.
10
Drupal 7 in a Day
4. Now revisit your Content listing at Find content in the shortcut bar. You can see your article there.
Structure
This section includes the building blocks of your website: whether is it containers for content (content types), saved queries (Views), or navigation control (blocks and menus). Keep in mind that new administration pages will become available in this area as you extend Drupal with new modules.
Block description: Welcome message. This helps site administrators know what the blocks purpose is on the site. This text will appear alongside the block on the block admin page and will not be displayed to users. Block title: Welcome to GlobalTravel.com. In the case that you do not want to add a title to your block, enter - <none> in the block title eld, or leave it empty. Block body: GlobalTravel.com is your one stop shop for all your travel needs. This will be the actual welcome message text in the block.
11
Drupal 7 in a Day
4. Next well assign this block to show up on your site. Scroll down to the Region Settings section. Under Bartik select the Sidebar rst region from the default theme regions select list. As the welcome message is intended for site visitors, well leave the admin theme region settings at the default of None.
5. Now well congure the visibility settings for the block. Drupal allows you to specify on what pages your block is displayed on, with which content types it appears with, and to whom it is displayed. We only want our Welcome Message block to appear on the front page.
Under the Pages section of the visibility settings, select Only the listed pages.
12
Drupal 7 in a Day
6. Save block. 7. Navigate to the front page of your site to see the new welcome block in the rst sidebar section of the page.
Appearance
The look of your Drupal site can be changed entirely through the use of templates in the Theme System. In Appearance you can see the default themes included. You can add more, customize
13
Drupal 7 in a Day
existing themes or create your own. Lets see how we can alter theme settings to change the look of the site.
1. Go to Appearance, and click the Settings tab. Under Global settings > Toggle display deselect Logo.
2. Click Save conguration. 3. Close the overlay. Now the logo is gone. This toggled the display of the logo.
People
This is where you can create user accounts, and manage permissions. Note that you add and manage Roles under the Permissions tab.
Drupal 7 in a Day
Modules
From this listing you can enable and uninstall additional scripts called modules. We will do more activities with modules soon. Notice for many modules there is a quick link to help, or to modify permissions, or to congure the module. A good practice is to disable any modules which arent in use to free up resources.
Conguration
Here you see a list of main operations such as managing search, regional settings and overall account settings. Lets change a conguration option to see how this works.
3. Close the overlay by clicking X. Youll notice the page refreshes and title of the site has changed. Much better!
Drupal 7 in a Day
Select Enable clean URLs. Save conguration. 2. Close the overlay and return to your account page. What does the URL look like now?
Under most circumstances, your server should be congured to handle clean URLs. If not, please refer to the Drupal.org documentation. http://drupal.org/getting-started/clean-urls
Reports
Drupal keeps some basic statistics about your site here.
Choose Status report from the report options. Are there any tasks you should complete? Click on the Recent log messages. Have you generated any errors yet on your site? Scroll down to nd Update notications. Do you see a warning?
Help
This area is a summary of all the help information about any modules you have on your site. There are also quick links to relevant handbook pages on Drupal.org. You may also nd these modules useful while you're learning: Module name Advanced Help Description http://drupal.org/project/advanced_help For additional help, some modules employ the Advanced help tool. This provides in-context help. http://drupal.org/project/tutorials This module embeds contextually relevant tutorials into your Drupal site from Tutr.tv.
16
Tutorials module
Drupal 7 in a Day
Unit summary
In this unit you learned more about Drupal as a content management system. You did some exercises to see how you can quickly change the look and information on your site, as well as create a custom experience for users.
How does Drupal compare to a static HTML site? What other content management systems are you familiar with? What are some differences you see? Look at some of the sample sites shown by the instructor in the presentation. Write down some questions about how the site was put together. Look at the menus, the blocks of content, and the layout. Lets see if you can answer these questions later.
The difference between core and contributed modules. How to identify and assess healthy modules. They are not backward compatible but upgrade paths dont break data.
Connect to Drupal.org
Drupal.org is the ultimate place for Drupal. It is where you download projects, collaborate with others, as well as nd and contributed references are resources.
17
Drupal 7 in a Day
Create an account
1. Go to http://drupal.org/user/register 2. Fill out username, password, email address, and country 3. Create new account. Conrm your email. 4. Login to Drupal.org 5. Welcome to the Drupal Community!
3. Save conguration. 4. Notice the Contact module listing has new options available. Click Help.
5. Based on what you read in help, do you have an idea of how to use the contact module? 6. As soon as you have the Contact module enabled you can access it at: http://example.com/ contact
Drupal 7 in a Day
4. Modify the Recipients and add in multiple email addresses using a comma. 5. Add an Auto-reply message: Thank you for contacting us. We will respond shortly. 6. Save
D. Add a category
1. Go to Structure > Contact form 2. Click + Add category 3. Category: Advertisement 4. Modify the Recipients and add in multiple email addresses using a comma. 5. Add an Auto-reply message: Thank you for contacting us. We will respond shortly. 6. Selected: Select Yes. 7. Save
Consider the context of a travel website, which roles should be assigned these permissions? Notes User can alter settings, add email addresses and change messages.
19
Which role(s)?
Drupal 7 in a Day
User can ll out a contact form and send messages through the site
Send messaged through Users can send direct messages users' personal contact through their account pages. forms 4. Next, you will modify the permissions so anonymous and logged in users can use the contact form. Select the appropriate set of permissions.
Poll Tracker
20
Drupal 7 in a Day
Unit summary
You enabled a core module, contact, and added specic functionality to your site. The great thing is, you dont need to have all modules enabled.
Refer to the Appendix for a quick reference on Evaluating Drupal projects. If possible, you can try out both options, and install both modules.
Option 1: Install the Masquerade module with the Update manager What is the Masquerade module?
Masquerade is a module that allows you to switch between users. This is a valuable tool during development, as well as a way to investigate user error reports. By default, the permission to masquerade as a user will be limited to Administrators. The illustration here shows the block that is available after you enable the module.
A. Enable the update manager (if you have done this already, skip ahead!)
Drupal also has a tool to make updating and installing modules easier from the browser. 1. Enable the Update Manager. Go to Modules and select the Update Manager module. Save conguration to enable. 2. Check for updates. Click the new Update tab. At this point, you can check manually to see if you have to update any modules.
21
Drupal 7 in a Day
a. How active are the maintainers? b. Is there a stable version available for your version of Drupal (Drupal 7)? c. What is the maintenance status, and how many reported site using this module? d. Also good to keep an eye on the ratio of open to resolved issues.
22
Drupal 7 in a Day
2. Scroll down to locate the project download links. Locate the latest 7.x recommended release. Copy the link from your browser.
3. Now return to your websites Module listing. 4. Click the new option to + Install a new module. 5. Paste in the link to the compressed module directory. (Double check: The le should have an extension such as zip tar tgz gz. You can of course upload a le as well. ) 6. Click Install.
23
Drupal 7 in a Day
Dependencies When you go to enable the newly added module, you may notice a series of dependencies. These are highlighted in red as (missing) or (disabled). If missing, you will need to install the modules. The titles of the modules, with underscores if they have spaces, can help you get a quick link to the related project. For example, just add the name to the end of the URL for projects: drupal.org/project/Form_builder If they are just disabled, you will only need to enable them. If you need to, repeat the steps for installing a module for all the dependencies.
We are only interested in the Drupal 7 version, so click on the download link for this version to download the module.
24
Drupal 7 in a Day
Enabling a module does not always make it work automatically. Sometimes permissions and conguration options need to be set as well. On the modules page, you will often see a permissions link and a conguration link next to the module name.
Unit summary
In this unit you saw how you can extend functionality on your site by selecting and installing modules. Well look at modules in more depth later. Think of functionality you would like your site to have. Try to conduct a search for a module on your own before asking the instructor, use all the resources listed above. Ask the instructor for his or her experience with this module, and check if there are any alternatives.
Session discussion
In this session you became familiar with the most important parts of Drupal out of the box. You congured your site, added some content and a user. In addition you saw how you can extend what Drupal can do by installing modules. You saw how you can extend and customize Drupal through selecting the right modules and themes. You saw how the community shares solutions to commons problems with distributions and installation proles. Consider: How is Drupal like a CMS (content management system) builder?
25
Drupal 7 in a Day
26
Drupal 7 in a Day
4. Check the text format. This content can either be in plain text or HTML. If entering HTML, please take note of the Text format option under the body eld. If this is set to Filtered HTML, then only HTML tags that have been dened by a site administrator will work. If it is set to Full HTML, then all HTML tags will work. If a user has not been granted access to Full HTML by a site administrator, then the Full HTML option will not be listed under this section. Text formats might seem a bit confusing now, but they are one way your Drupal site stays secure. 5. The next thing we want to look at is the Menu settings section. Scroll down to the advanced settings.
27
Drupal 7 in a Day
As this is an About us page, we will want to give the page a menu link so that users can easily access it. Once the page has been saved, this will place the About us menu item in the Main menu, which is usually located just below the header of a site. Select Provide a menu link. By default the title About us is populated in the Menu link title eld. Enter a Description of the menu item (this will be displayed when a user hovers over the link), such as Find out more about Global Travel. In Parent item the Main Menu option is selected by default. The Weight option determines where your menu item will be positioned within a menu item list i.e. higher numbered items (10) are located at the bottom of the list, whereas lower numbered items (0) are located at the top. We'll leave this at the default setting of zero. 6. We are almost ready to publish our page, however there are a few more sections at the bottom of the page that we will want to check before hand:
Revision information This is for logging notes on revisions or updates that you make to content, and is therefore useful when you are editing existing content. URL path settings Specify a custom URL alias for content. Deselect Automatic alias. Under URL alias enter about-us. This page will appear at a path such as http:// example.com/about-us. Comment settings Enable or disable comments for this piece of content. As this is a static page, we will want to leave comments disabled by leaving the closed option selected. Authoring information - information on the person who authored/created the page, and the date and time it was created.
28
Drupal 7 in a Day
Publishing options this section allows you to specify whether the content should be published or unpublished, promoted to the front page, or made sticky at the top of lists. Leave the published option checked.
Tip: If Published is not checked its unpublished. This is how you keep content in a draft state in Drupal. This sometimes confuses new users. 7. Finally, Save. Close the overlay and go to your home page. Now you should now see a new menu item within your Main menu called About us. If something has gone wrong and you don't see this menu item, you can go to the Content section, which lists all of the content on your site, and look for it there. Make sure to set the link in your main menu.
Optional Exercise - Add an Article (optional if you have created an article in Session 1)
1. Lets see how a different content type works. Go to Add content > Article. Title: Great places to travel! Tags: island, sun, winter Body: Enter some sample text. Leave all other default options. 2. Click Save.
3. Click Save. This will reload the item. 4. Click the Revisions tab. Here you can see previous versions of the content. 5. Click Revert for the previous version and follow the on-screen instructions. You can see your previous iteration was copied rather than overwritten.
29
Drupal 7 in a Day
Lets look at the difference between these two in their conguration settings. 1. Go to Structure > Content types. 1. Click on edit next to Articles. This loads the edit form.
30
Drupal 7 in a Day
2. Scroll down to the advanced options and click Display settings tab. This is the default setting for the Articles content type. You can also override this when you add a new article.
Manage content
Go to Content in the admin bar /admin/content. This Content Administration Page displays all of the content on our site and allows us, among other things, to edit or delete any of this content.
31
Drupal 7 in a Day
When you have a lot of content on your site, using Update Options will save you time.
Workbench
Drupal 7 in a Day
types. Content types are one of the most powerful features in Drupal. Drupals content creation tools allow you to create forms containing a variety of elds such as select lists, text elds, checkboxes, image elds, etc. all without writing a single line of code.
Drupal 7 in a Day
Under Add new eld, Label: Do not miss Field name: eld_donotmiss Select eld type: Text 2. Click Save and this loads the Field settings Maximum length option. Keep default and click Save eld settings.
3. This loads the settings for this content type. Keep the defaults and click Save settings.
4. This loads the eld settings for this content type. Keep the defaults for Allowed le extensions. 5. Under File directory add a subdirectory city guides.
6. Select Enable Alt eld 7. Keep remaining defaults and click Save settings.
4. This loads the eld settings for this content type. Under Help text type Put each item on its own line. Under Text processing select Filtered text (user selects text format) 5. Click Save settings.
34
Drupal 7 in a Day
6. The manage elds form should look like this now with all your new elds.
2. Click Save.
35
Drupal 7 in a Day
2. Test with another one of your favorite cities. If you have an image, add one.
3. After you save the content type you can see the order of the elds is displayed differently than it was entered. Later we will do more work on how these City guides display.
Unit summary
In this unit you saw the differences between the basic content types, and how you can customize your own with additional elds. The bulk of planning and work you will do on your site is carefully mapping out content types and how they are displayed on your site. You added quite a number of elds already. Consider, if you wanted to change the values of, for example, the salary ranges youll be able to do this easily. Compare that to if you had entered all the data into an unformatted text eld. It took more effort to set up, but will save you headaches in the future. Review the elds you added. Go to Reports > Field list to see a list of elds added to your site. You can use elds across multiple content types, which can offer some advantages because you can edit some global settings and values in one place. Think about a new content type you would like to add to this site.
What display settings suit your content type? What elds does your content type need? When would you use a multiple choice text eld, and when would you use a taxonomy vocabulary with terms? What would be the advantages of either choice?
36
Drupal 7 in a Day
What advantages does Drupal offer when you upload images into a eld, instead of linking to an image directly in HTML?
37
Drupal 7 in a Day
2. Our new Audience vocabulary is now listed on the main Taxonomy page. The next step is to add terms to the vocabulary. Click add terms link listed under Operations. 3. Lets add our rst term Adventurous
Name: Adventurous Description: For people who like to try out new places and take some risks. Text format: As we are not using any HTML, change to Plain text. Leave the remaining defaults. Click Save.
4. Saving reloads the form for entering more terms. Repeat the process entering the following terms with a short description for each: budget minded families high iers 5. Click the word Audience in the breadcrumb to go back to see the listing of all terms in the vocabulary. Notice how the terms can be reordered in any arbitrary way, but by default they are alphabetical. You can also drag terms to be child terms of others. In this way, Drupal
38
Drupal 7 in a Day
Label: Audience Name: eld_audience Field: Select Term reference Widget: Checkboxes/ radio buttons
Save. This reloads to the eld settings page. Vocabulary: Audience should already be selected. Save eld settings. This reloads to the Article settings page. Select Required eld. Help text: None Default value: None Number of values: Select Unlimited
39
Drupal 7 in a Day
Unit summary
You have seen how to relate content across the site. When you click the terms your see a list of related content generated, for example at a path like /audience/adventurous. Note at the bottom of the page, you will see an icon for an RSS feed for that term. How could you change the taxonomy term entry into to a drop-down menu? Or radio buttons?
Account settings: Control whether anyone create an account on your site, or if users need administrator approval. User accounts: When someone registers with a unique email address. User proles: Add elds to allow users to provide additional information. Roles: Make custom roles to organize users into groups to which you can assign permissions and access rights. Permissions: Control which roles can create content, or use module-specic functionality like the contact form.
Security note: The basic rule of thumb when it comes to users is to apply "Least privilege"
40
Drupal 7 in a Day
Give as few permissions as possible to get the job done. Only grant the roles that they need.
It is therefore extremely important that you make use of Drupal's User Role and Permissions features to eliminate the possibility of unscrupulous users taking advantage of security vulnerabilities on your site.
http://drupal.org/project/imagecache_proles Set user prole images across the site, and specify different display sizes for user comment and prole images.
http://drupal.org/project/logintoboggan Improve the registration and login experience by allowing users to register and login instantly; and to login with their email address. You can also place a login form on an Access denied page, and more. http://drupal.org/project/permission_select This allows you select groups of permissions, and check all and uncheck all options per role, making it easier to manage a number of roles to with myriad permissions.
LoginToboggan
Permission select
We want visitors to be able to register for new accounts in order to post comments on the site. However, we want the site administrator to manually approve each account application rst, before granting visitors comment privileges. No changes are necessary at this time.
41
Drupal 7 in a Day
Personalization
In the account settings area you can also allow users to upload images as a user picture, or to enable signatures to be included when posting content. No changes are necessary at this time.
Emails
Finally, in this area you can also modify the email notications which are sent at various events such as Account activation or Password recovery. Review these settings.
site visitor
editor
administrator
Anyone who is visiting your site and is not logged in. Anyone who is logged into your site. You can assign additional custom roles to this kind of user. In the illustration above: site visitor, editor and administrator.
42
Drupal 7 in a Day
Super user
This is the rst account on the site with the user ID: user/1. No matter what you do to permissions, this user will always have all permissions assigned. Only log into this account during development.
Site editor: Can create new content, and edit all content on the site. Site visitor: Can leave comments and use the contact form.
First lets review the default settings and get familiar with the interface and conguration options.
Notice the Administrator role was automatically assigned permissions to the default content, but not the new content types. When we added the content type, we didnt change these permissions. Therefore, depending on whether you add your roles rst or your content types rst, you will need to check the relevant permissions as the nal stage. You are the Super user! Remember, permission rules do not apply to the Superuser youre logged in as. That account is automatically granted full permissions to all enabled modules. Get into the habit of going to the Permissions admin page People > Permissions every time you enable a new module, or add a content types to set permissions.
43
Drupal 7 in a Day
Create new content Edit any content Delete any content 3. Select to give administrators the all permissions.
4. Double check to ensure you have not accidentally selected any of the other permissions and then
44
Drupal 7 in a Day
As a rule, we are choosing to give the Administrator most permissions. This will allow for most work to be done without needing to resort to the super user account. Site editors, a trusted role, are being given access to some administration functionality, such as the overlay and the toolbar. They should also be able to manage taxonomy terms and approve comments.
Use the table below as a guide. Any permissions not listed here can remain as the default settings. Permission Comments Contact Administer comments Use the site-wide contact form Use users' personal contact forms Contextual links Overlay Path Search Use contextual links Access the administrative overlay Create and edit URL aliases Use search Use advanced search Taxonomy Administer vocabularies and terms Edit terms in Audience X X X X X X X X X
Site visitor Site editor Administrato r
X X X X X X X X X X
45
Drupal 7 in a Day
Delete terms from Audience Edit terms in Tags Delete terms from Tags Toolbar User Webform (depends if you have this module enabled) Use the administration toolbar View user proles
X X X X X
X X X X X
Review all the permissions you have assigned and click Save permissions when you are done.
2. In the Username eld enter testeditor. Make note of the email and password you entered. Tip: Drupal does not allow you to use the same email address twice. You can add a +1 before the @ symbol in an email. This allows you to create multiple accounts with the same email. Such as email+1@example.com and email+2@example.com. 3. Under Roles select site editor. Take a moment to notice, the authenticated role option is selected by default. This is because every registered user is by default, an authenticated user, and will be assigned the basic permissions that come with this role automatically. Any additional authenticated roles that you create i.e. the Editor role, will inherit the permissions set by the authenticated
46
Drupal 7 in a Day
user role. You can edit the permissions for the authenticated user role on the permissions admin page /admin/people/permissions. 4. Click Create new account. 5. Now, repeat the same steps in order to create our test Site visitor account, using testvisitor 6. Make a note of the username and password and click Create new account.
Option 1: Logout of the superuser account, and log back in again as testeditor. Option 2: Open another browser and login as one of the test users. Option 3: If you have the Masquerade module installed from Session 1, use that to switch users.
As you view the site in the different roles, what differences do you notice on the site? 1. Navigate to an article and scroll to the bottom of the page. You should see an Add new comment form. Go ahead and post a new comment and save it.
2. Click around the site checking to ensure that you do not have access to anything that you shouldn't have access to as a Site visitor. 3. If all is good, logout and revisit the same article as an Anonymous user to ensure that you cannot post comments on this page. You should see a Login or Register to post comments message in the bottom of the page. 4. Now to test the Site editor role. Login to the site using the testeditor user account we created earlier. What differences do see on the site now? What you test will depend on what operations this user should be able to perform. For example, now you can see the content listing and you are able to edit and administer the content. The same methods we used to check permissions for the Site Visitor role can be applied here also. However, you will have more options to check and you will want to conduct a lot more tests (i.e. creating, deleting, and editing content, etc.). For both roles, you will want to be extremely thorough in your testing.
Unit summary
In this unit, you saw how to group users into roles related to their level of access and control. You saw how you could control user account creation and control the privacy of your site through permissions.
Think of a website you would like to make. What Account settings would you use? Do you want people to be able to create an account and begin to use your site?
47
Drupal 7 in a Day
With many roles, the management can become tricky. What is the least amount of roles you could use on your own site? What are some things that can go wrong with permissions when you are adding new content types to your site?
Session discussion
In this session we designed a content type. We can think of any site in terms of the content types available. What kind of site are you making? Think of a content type and consider what elds or taxonomy terms you will use. Consider these examples. What kind of elds could be used? What input widget and which could be taxonomy terms?
Course: Title, description, level, pre-requisites, subject area. Portfolio: Title, image, medium, size, genre. Recipe: Title, ingredients, directions, cuisine.
You also saw how content management depends not only on the design of content types, but also the permissions you set for who can manage the content. We broke this down into two distinct steps so we could take a moment to explain the users and roles functionality in Drupal. However, in the future, whenever you add new content types, you should always check the permissions.
48
Drupal 7 in a Day
Session 3: Site Building with Drupal Unit 3.1 - Create lists of content with Views
What is Views?
Further information available at http://drupal.org/project/views. Views is one of the most popular contributed modules, and is used on many sites to select content, sort and display in various ways. Views allows you to create and save named queries of your content, and control how the content is presented. Some examples:
You could create HTML lists of all content titles linking to the full page. You could create a list of city guides. You can also create lists of taxonomy terms, users and comments, and sort in various ways.
Content
Pet-friendly holidays for the whole family. Drum and dance in Mali. Indian adventure on a river boat cruise. Mud baths and hot springs of Beppu. Hidden Paris by night in the winter.
Users
E. Webb
Germany
Taxonomy
adventure budget minded
Comments
Wow, can't city breakwait to get started.
johan 8 Sept
J. Beeman
Spain
Me too!
Before we start
Depending on your set up for your course, you may need to install these modules and enable them.
View name: City guides Show content of type City guide sorted by Newest rst
Create a page should be selected by default. Keep the page title and path defaults.
49
Drupal 7 in a Day
Under Display format: Unformatted list of teasers without links and without comments Select Create a menu link. And main menu will be selected by default.
3. Click Save & exit. 4. Now, when you return to your front page you will see a city guides menu link and the teasers.
Drupal 7 in a Day
2. Click the Teaser tab. You can see the city pic is hidden. Drag this to the top area to make it display. Label: Select Hidden. 3. Click the gear to open the Format settings for the city pic Image.
Image style: Select thumbnail. Link image to: Select content Click Update. 4. Drag the City picture to above the Description and then click Save.
View name: Audience Show Taxonomy terms of type audience sorted by Unsorted
Drupal 7 in a Day
Display format: HTML list Items per page: 5 4. Click Save & exit.
4. Scroll back up to Sidebar rst and drag the View: Audience to the bottom of the Sidebar rst list. (what blocks show up on your site depends on which activities you have completed).
5. Click Save blocks. Now you will see your block showing up in the sidebar.
52
Drupal 7 in a Day
Next, modify the authors so there is some variety. To do this, edit the existing articles and city guides. Scroll down to the Authoring information tab. And type in the names of the other users.
View name: About the author Show Users sorted by Newest rst De-select Create a page Select Create a block. Keep the defaults. Click Continue and edit
53
Drupal 7 in a Day
This now loads the full Views editing screen. This illustration correlates to the steps outlined below.
54
Drupal 7 in a Day
Make the display dependent on the author of the content (contextual lter)
1. On the right hand side, click to expand Advanced. Next to Contextual lters click add. 2. This loads a long list of options. Use the search eld locate user ID
Select User: Uid Click Add and congure contextual lters. This loads the next screen. 3. Select Provide default value. This opens some additional options.
Under type: Select User ID from URL Select Also look for a node and use the node author.
Drupal 7 in a Day
5. Youll notice now that the preview isnt displaying anything. Type in an argument. For example, 1 (which was the rst node created on the site). Or 7 (if you have a node with that ID). This should display an author. 6. Finally click Save at the top of the Views editing screen. Were nearly done.
Scroll down to the Visibility settings. Select Article and City guide. Click Save block. OK! So go back and check your site. You should see the block appearing next to articles as you planned.
Drupal 7 in a Day
The About the author block should show only on city guides and articles. It should be visible to anonymous and logged in users. How could you improve this? Maybe adding additional prole elds to the users accounts?
Unit summary
Views is a powerful tool for listing content. You have seen how you rst select a base table, whether that is Users, or taxonomy terms. The basic options are powerful enough, and you can also get more specic with the full Views editor. If youre familiar with writing your own database queries, this will look like a pretty handy tool. It also means someone without coding experience can gather complex queries of content and control how they display. Weve only scratched the surface of how you can display various elements of your site, whether its content or terms. Many other options are available.
Drupal 7 in a Day
Leave the default Menu link title Description: Frequently asked questions Parent item: By default Main menu has been selected. 4. Next, we are going to dene our URL alias. Under URL path settings tab, de-select Automatic alias (This option appears if you already have Pathauto enabled).
5. Click Save. 6. Navigate to the newly created FAQ page. You should notice that the node is now using the URL alias that we just assigned to it - http://example.com/faq
http://example.com/travel-article http://example.com/travel-article/article-title
The second part of this pattern, the [node:title] section, is a token. Tokens are placeholders that allow you to dene dynamic content in this case the node title. Tokens are generated by another contributed module the Token module - http://drupal.org/project/token. The Pathauto module depends on the Token module and so you will need to enable this before you can use Pathauto.
Drupal 7 in a Day
Web Page Title http://example.com/city-guides Google
Site title
Slogan
(banner)
Slogan
(banner)
Login
name password Log in
Login
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia. Separated they live in Bookmarksgrove right at the coast of Semantics, a large language ocean. name password Log in
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, Countries Vokalia and Consonantia, there live the blind texts. Separated they live. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language.
What to pack
Towel Flip-ops
3. Click the Patterns tab at the top of the page. Under the Content Paths section, youll see the Pattern for all Article paths eld.
59
Drupal 7 in a Day
4. Click to expand Replacement patterns and click to expand Nodes to locate the correct token to use for node titles. This section lists all of the tokens that are available to us for nodes. Locate the title token [node:title]. We will use this in our URL alias pattern. Tip: You can either copy and paste the pattern, or click on the text eld, then click on the pattern and it will populate the text eld for you. 5. Modify the pattern for the Pattern for all Article paths eld, so that it looks like this travelarticle/[node:title]
60
Drupal 7 in a Day
Regions are dened in each theme. These are unique areas of the template les into which you can place blocks. Blocks can be positioned into areas of your pages called regions. Blocks, the default system in Drupal, are contained sections of content or data. Blocks are often used to display sidebar information and menus. Blocks can be dened by modules such as the menu system, or they can be created with custom content dened by you.
61
Drupal 7 in a Day
Web Page Title http://example.com Google
Blocks
Site title
Slogan
Site title
Slogan
header
Regions
(banner)
(banner)
Welcome
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.
Welcome
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.
Sign up
Name
Login
text E-mail sidebar second text name password Log in
main content
A small river named Duden ows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences y into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas.
About you
Vendor Partner Client
Button
Explore blocks
Before we begin building our own blocks, navigate to the Blocks Admin Page. Go to Structure > Blocks at /admin/structure/block Lets get familiar with this page. The block admin page gives you an overview of all the blocks used on a site and the region in which each one will be displayed. 1. Click Demonstrate block regions (Bartik) to see what regions are available. Each theme will be different.
2. Click to Exit block region demonstration. 3. Review the block listing. Notice that in the default theme, Bartik, the search form, navigation, and user login blocks are displayed in the Sidebar rst region. Your block listing may look slightly different, depending on the exercises you completed.
62
Drupal 7 in a Day
5. After you have done this, scroll down and click Save blocks.
6. This is a great way to control where blocks appear. Look at the options available under content types, roles and users.
63
Drupal 7 in a Day
7. Click Save blocks. 8. Now check around the site. You should see the recent comments only appear on travel article pages. 9. Bonus: edit the block visibility and make this block also appear on city-guide paths.
Unit summary
You saw how you can control where blocks appear on the site. Look at some of the case studies, and example sites you identied from showcase.acquia.com Can you see how these sites were assembled from blocks?
It would make more sense to place the Home link to the leftmost position. We should also include the a link to the contact form.
Click Save.
64
Drupal 7 in a Day
4. Return to your home page and you should see the Contact us link now. Your menu might look something like this...
3. Click Save conguration. 4. You can see your menu has now been updated.
Drupal 7 in a Day
sophisticated, the simple rule to remember with SEO is - if content is relevant to humans, it is likely to be relevant to search engines also.
3. Modify Tracking scope. You can also add exceptions to what get monitored. The default exceptions block analytics of visits to administration pages, among others.
4. Save Conguration.
Recommended modules
There are other modules that can further improve your search ranking by streamlining your site for search engines.
66
Drupal 7 in a Day
XML Sitemap
http://drupal.org/project/xmlsitemap Adds a sitemap conforming to sitemaps.org specication to allow the overall structure of your site to be easily seen by a search engine. http://drupal.org/project/globalredirect Search engines dont particularly respond well to duplicated content. Global redirect ensures that paths that lead to the same content are rewritten so that only the best URL available is used.
Global Redirect
Session discussion
Site building requires some forward planning, a good amount of research, and plenty of experimentation. These are the central aspects to site building:
Module selection and conguration Content planning, content type design and display Display and layout Navigation and information architecture
If youre continuing on to the Site building course, you will get more experience with developing unique functionality which you can apply to your own site.
Often developers nd that module selection is the most important part of the process. Well look at this more closely next.
67
Drupal 7 in a Day
Drupal.org Case study page: http://drupal.org/cases Acquias case study page: http://acquia.com/resources/casestudies Forums - showcase http://drupal.org/forum/25
In these case studies you can nd reports on how these sites were built. See for example, Symantes case study - http://drupal.org/node/1061630
68
Drupal 7 in a Day
Varnish Software use a variety of modules to get their site looking great with the functionality they need. Here is a selection of modules which you may like to try out.
Chaos Tools with Page manager http://drupal.org/project/ctools Allows a site manager to control the layout of specic pages . Content Access http://drupal.org/project/content_access to get control over who has permissions to see certain content. Mollom http://drupal.org/project/mollom Protects a site against spam with content moderation. Site Map http://drupal.org/project/site_map This module provides a site map that gives visitors an overview of your site. It can also display the RSS feeds for all blogs and categories. Twitter http://drupal.org/project/twitter Provide API integration to display tweets associated with users, and to post tweets to twitter. Webform http://drupal.org/project/webform Used to create surveys in Drupal. Varnish http://drupal.org/project/varnish Provides integration with their Varnish HTTP accelerator.
69
Drupal 7 in a Day
Take a closer look at how their site is organized. Browse through the additional pages, and nd the common elements on each page. By the end of the day today, you will have a good idea of how a site like this is assembled.
70
Drupal 7 in a Day
A. Add a webform
1. Go to Modules and ensure the Webform module (installed previously) is now enabled. 2. Go to Add content > Webform 3. Go to Structure > Content types and you will see a new content type called Webform.
Title: Special offer Body: Please ll out the form below for a special discount code. Scroll down to Publishing options and de-select Promoted to front page Leave all other settings as default and Save. This brings you to the Webform editing screen.
Default value: %username (click to expand Token values if youre curious!) Click Save component. This takes you back to the Webform component page. 3. Next, lets add an email eld.
In New component name: Your email Type: Select E-mail Select mandatory Click Add.
71
Drupal 7 in a Day
4. On the next screen, leave all defaults except for: Select User email as default Click Save component. 5. Next, lets add an opt-in question. Can we add them to our mailing list?
In New component name: Mailing list Type: Select Select options Select mandatory Click Add. 6. On the next screen, leave all defaults except for: Options: (safe_key|Some readable option)
0|No, thanks. 1|Yes. 7. Click Save component. Your settings should look like this:
8.
Click the Form settings tab. This brings you to the Submission settings options.
Conrmation message: Thank you. Here is your discount code: TRAVEL123 Click Save conguration.
C. Test
Go to the View tab to see the form and test it. You could of course change the conformation message to include a download link, or add additional elds to gather some more information about your visitors interest.
72
Drupal 7 in a Day
3. Click Save conguration. 4. Now, locate the disabled block and place it in a sidebar.
Unit summary
In this session, we extended what Drupal could do by adding and enabling a module, Webform. How is webform different from the default contact form?
You can search for themes directly at http://drupal.org/project/themes In the sidebar, locate the Most Installed list of themes. An up to date list of theme services is maintained at http://design.acquia.com/themeproviders
73
Drupal 7 in a Day
Marinelli
Corolla
B. Place in your theme folder 1. Create a theme folder so you have sites/all/themes/ 2. Unpack the downloaded archive and move the directory to /sites/all/themes/
74
Drupal 7 in a Day
3. You now have all the theme les in your folder. http://drupal.org/project/busy sites/all/themes/busy
C. Enable the theme 1. Go to Appearance and locate the Busy theme under the "Disabled Themes" section.
Keep in mind, you can have multiple themes "enabled" but not active.
75
Drupal 7 in a Day
3. View your site. You should see some changes. 4. If you have time, try another theme.
2. In the Global settings, under Toggle display, De-select "Logo", De-select "User verication in comments". 3. Click Save conguration.
76
Drupal 7 in a Day
Go to Structure > Block and double check which blocks are displaying. Your block options may be different depending on which exercises you completed.
Select Aggregate and compress CSS les. Select Aggregate JavaScript les. Click Save conguration.
Now return to your front page, and view the source. You can see there are a minimum number of CSS and script les now. Much better! Important: Because you are continuing to develop your site. Return to Conguration > Performance and turn the CSS and JavaScript compression OFF.
Uninstall themes
Following a similar process with modules, you rst must disable the theme you want to uninstall. If your theme is currently the default, you cant disable it. Therefore, you have to set another as default. After the theme appears in the disabled section, you can safely remove the theme directory from your le system.
77
Drupal 7 in a Day
Unit summary
As you have seen the theme system is the point where you can gain complete control over the markup and presentation of your site. Youve seen a number of themes available, and how you can explore and try them out.
Together installation proles and full distributions provide a packaged solution to make a complex site quickly. If you can nd an installation prole close to your own needs you can save time in getting set up or you can reverse-engineer how they set up the site to learn more. http://commons.acquia.com/ (demo and user community site) A community website based around group memberships.
http://usecod.com Conference organizing distribution - A conference website with various tools http://scholar.harvard.edu (demo) For educational institutions. Includes professor pages, class catalogs. http://openatrium.com/ For making project management sites with task assignments.
78
Drupal 7 in a Day
http://openpublishapp.com/ A solution for newspapers to bridge the gap between paper and online versions. Some agencies have developed entire services and expertise and offer additional paid support. For decision makers this can be a fast track to a complete solution. If youre a developer you might think about how you can make a distribution to share your niche expertise.
Session discussion
Drupal out of the box has some good functionality. However its only when you connect to the power of contributed modules that you begin to customize the product that you need. Researching and selecting those modules is an important step of the process. Install proles and distributions might be available to provide a complete solution for you. If not, they might help you identify useful modules. Themes are the last step of the process. In some cases you can use a theme right out of the box. However its likely youll need to do some customization. How you customize those themes will change from theme to theme.
79
Drupal 7 in a Day
Grab a partner! You can work with a partner or a small group. Here are two new clients! You can choose between them and use the details here as a guideline. Use your imagination to answer some of the unknowns.
Step by step tutorials to excite people about reusing cast off materials in creative ways. Contributors can apply to be tutors and write articles. Contributors can submit videos to demonstrate techniques. Inspiration: .Net magazines tutorials for some ideas. http://www.netmagazine.com/tutorials
Site wireframe:
80
Drupal 7 in a Day
Option 2 - Client Museum of wonderful things Scenario: An online presence for a favorite museum
The is a website for a special bijoux museum. The site helps keeps repeat visitors coming back again, while enticing potential visitors to see what is on offer. Events are highlighted on the site. Visitors can peek a the collection online. Inspiration: Check out Field museums website for ideas http://eldmuseum.org/
Site wireframe:
81
Drupal 7 in a Day
Questions to answer:
1. What contributed modules do you think you will need to install? Do some research, there will be modules you havent tried yet today. Are there Drupal 7 versions of the modules? Are the modules you chose healthy? 2. What user roles will your site need?
3. What content types will the site need? (use the content type worksheet following) What elds will be needed? Who should be allowed to create content? 4. How will the content be displayed?
Manage display.
How should the content display? Who can add, edit and see this content?
Set permissions.