Flag: Custom flags for nodes, users, and comments

Last modified: March 19, 2009 - 10:34

The Flag module is a flexible flag system. Using this module, the site administrator can create an arbitrary number of 'flags' for nodes. Oh, did we just say 'nodes'? The module also supports flagging users and comments (but to ease writing this document we'll mention only nodes).

In this way, additional flags (similar to published and sticky) can be put on nodes and dealt with by the system however the administration likes.

What uses are there for flags?

Here are some possibilities:

  • Bookmarks
  • Friends
  • Favorites
  • A simple "digg" system
  • An "I've been here" tab for nodes on a tourism website
  • Marking spam
  • Marking "Important"
  • Marking "Needs review"
  • Editor picks
  • A basket to collect nodes, and then mass operate on them.
  • Controlling access to tabs.

Incidentally, this module was previously known as Views Bookmark. We didn't like the word "bookmark", because it didn't reflect its general purpose, so we renamed the module.

Private flags vs global flags

Flags may be per user, meaning that each user has her own private "copy" of the flag; different users can flag, or unflag, a node individually. Or a flag may be global, meaning that any user who changes a flag changes it for everyone.

The use of any flag can be restricted to certain roles.

Links and buttons

Flags are usually controlled through links that allow users to toggle their state. For each flag the administrator can choose the "Flag this!" text, and whether that link appears for the node teaser as well as the full node view.

But the links don't have to look boring: you can easily theme them to look like buttons, of various kinds.

Buzzword compliant!

Flags are exposed to the Views module, and a default view is provided, of a "My bookmarks" variety.

The module comes installed with a flag named "bookmarks", and you'll find a "My bookmarks" item on the menu, which is in fact a view listing all nodes flagged by this "bookmarks" flag. This module provides many Views filters, fields, and sort criteria to make all sorts of displays possible, even ones relating to the number of times a node has been bookmarked.

Action! Action! Action!

Flags aren't just for creating passive "My bookmarks" lists. Flagging a node can fire some actions. This module supports the Actions module (Actions is now included in Drupal 6 core with no additional modules), and the more powerful Rules module.

Simple examples, for actions, are unpublishing a node that has been flagged as "spam", or sending an email to the administrator when a node is flagged as "spam" more than 3 times.

Where do I start?

To start experimenting with this module, go to "Administer » Site building » Flags".

 
 

Drupal is a registered trademark of Dries Buytaert.