Viewers: in countries Watching now:
This course teaches web site designers how to take their sites to the next level with a few advanced techniques and the free and open-source Drupal software. Author Tom Geller shows how to configure the most popular add-on modules; use *nix commands and an FTP program to manage a Drupal site on a web server; change its visual appearance using the latest graphical tools; automate and speed through common tasks with Drush; integrate with social media sites; and see how "supermodules" like Panels, Context, Rules, and Features open up new worlds of code-free development.
Drupal 7 Advanced Training was designed as a follow-up to Drupal 7 Essential Training and it also dovetails nicely with our other Drupal courses, such as Drupal 7 Reporting and Visualizing Data and Create Your First Online Store with Drupal Commerce.
One of the best ways to encourage user participation is to set up a voting system. I will give you an example. The local baristas at the cafe in my hometown of Oberlin recently discovered that instead of just having one tip jar next the register, they now have two, labeled Ella Fitzgerald, and Billie Holiday. You vote by putting your money in the one you like better, and I hear that tips have gone way up, because people insist on voting for both. Anyway, yes, voting; Drupal does it. Let's look at some of the ways. First up is the Poll module.
I showed it off in the Adding Polls video in the Drupal 7 Essential Training course. But very quickly, here it is again. You first have to enable it, and you do that by going up to Modules, and finding it in the Core group. Turn it on, and save as usual. That creates a new content type called Poll. So we just Add content, select Poll, and then add our question, and then save.
You vote on it simply by viewing the node. Here I will select Option A, and Vote, and Drupal keeps track of who has voted, so now that I have voted, I can't vote again. Instead, I see the results of the poll. However, the Poll module is extremely limited; it only gives you these radio button choices. So let's move on to Contributed modules. There is a huge selection; so many that they have their own category on drupal.org. As usual, we go to drupal.org/ project/modules; Filter by compatibility, and then choose the Evaluation/Rating group, and Search.
These are sorted by popularity, so I will just go through the first few. First up is Webform, which I don't consider a voting system, per se. It's really for surveys. If you're curious about it, see the video Getting Feedback with Webforms in my Drupal Gardens Essential Training course. Next up is Voting API. It doesn't have an interface of its own; instead, it's an internal framework for all the other voting modules. We have to install it anyway, so we might as well do that now. I will open a new tab.
That URL is drupal.org/project/votingapi. Go down, and install it as usual. Although it doesn't have an interface directly, it does have some configuration options. We see them by going to Configuration, and then down to Voting API. Let's go back, and take a look at those modules. Now we move on to Fivestar, which I would consider the first real voting module we've seen in this list. I showed how to use it in the video Allowing Users to Rate Content in Drupal Gardens Essential Training.
But once again, I will give a very quick demo here. We go to the Modules homepage, which is at drupal.org/project/fivestar. Scroll down, and install it as usual. The group it's in is way down at the bottom. Then we Save configuration. To make use of Fivestar, you create a content type, and then add a field type that represents Fivestar. I will do that now. Go up to Structure, Content Types, and Add content type.
I'll call this Fivestar vote. Then I will go back, and add some fields. Really, the only one I need is a voting field; Vote for this node. The Field type is Fivestar Rating, and you have a few different options here. I will leave it on the default, and Save. And in fact, I will just take all of its default settings. Now we can create some content of that Fivestar vote type, and Save.
The last one up in our quick survey is the Flag module. It's an incredibly elemental module. It just lets people flag content, but that too can be used as a simplified yea or nay voting system. So let's take a look. I will open that up in a new tab, and as you see, the URL is drupal.org/project/flag. Flag is one of the best documented modules I've seen. First of all, it integrates with several other modules, and you can see the full list by clicking this many modules link here. Look that; 162 modules integrate with it.
It also has terrific documentation. If we scroll down, you see all of these articles that are about flagging. But let's just go ahead and install it. Flag actions is worth exploring, but we'll just leave it off for now. Go to the bottom, and save. Once that's done, you can see a record of the type of flags available under Structure, and then click Flags.
When you install Flags, it comes with one type; this bookmarks kind of flag. We could go back and edit this flag, but I think I will create a new one instead. I am going to create a flag that lets people to vote on whether we should keep content, or delete it. I will name it keep_this_content, and notice that you need a machine name, not the human readable name, so it's all lowercase letters, and underscores. We'll have it affect nodes. As you can see, you can also have people flag users, which is extremely useful if you start to have problematic users or comments.
We submit, and then we can fill out a lot more options. The Title I will just have as Keep this content? This is an administrative title. I just want to talk a little about this next option: Global Flag. For any voting system, you're going to leave this off. When it's turned on, the vote is shared among all the users, so one person might click it to say yes, keep this content, and then if the next person clicks it again, that switches everybody's vote back to no, we want to delete this content. So we'll leave that unchecked. For the Flag link text, I'm going to say, I like this content and think it should stay on the site.
By the way, I noticed a bug in the version of flag that I'm using, where if you enter too short a flag link text, it actually doesn't appear correctly on Bartik. I hope and expect that that will be fixed by the time you see this video, but if not, play around with the length of this text. For the Flagged message, I will say Thank you for your vote! Unflagged, I will make very similar; I dislike this content and think it should be removed. And the Unflagged message will also be, Thank you for your vote! There are lots and lots of options here, but the most important one is which content you want to be able to flag.
I will do it for basic pages, then go down, and submit. Now let's test it by going to our front page, and finding a basic page. There's one, and as you see, there's our flag. If we go to the node itself, we see that, by default, the flag is also on the full view of the node. Well, let's say that I do like this content. I click that, and I get that message: Thank you for your vote! It also changes the flag to this, I dislike this content and think it should be removed, so obviously, you can change your vote as you go.
One last thing you should be aware of when you set up voting on your site, no matter what system you use: by default, most voting systems don't allow anyone except administrators to vote. The Flag module is unusual in that it stores permissions on a flag by flag basis, but the others store them with the site-wide permissions. So whenever you install one of these, be sure you go to People, and then Permissions, and then scroll through to see how the permissions are set. For example, there's Fivestar, there's Flag; now, for Flag, it's only administer flags, so people can still vote on a flag by flag basis, as I say.
There is Poll, and again, people aren't allowed to vote on polls by default; we only could because we were the administrator, and so on. Now, there is one kind of voting system we didn't talk about; that's the one that you build yourself. If you watched lynda.com's Drupal 7 Reporting and Visualizing Data course, you know everything you need to add a voting field to each user's profile, and then collect the results into a view. But I've found the systems you saw here to be easier to use, with features that would be hard to implement from scratch.
There are currently no FAQs about Drupal 7 Advanced Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.