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.

Flag features

What uses are there for flags?

Here are some possibilities:

  1. Bookmarks
  2. Friends
  3. Favorites
  4. A simple "digg" system
  5. An "I've been here" tab for nodes on a tourism website
  6. Marking spam
  7. Marking "Important"
  8. Marking "Needs review"
  9. Editor picks
  10. A basket to collect nodes, and then mass operate on them.
  11. 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.

Note that a global flag does not record the UID of the flagging user. If you need to know who flagged an item, do not set the flag to global.

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 included in core as of Drupal 6), and the more powerful Rules module.

Simple Actions that could be triggered by Flags:

  • automatically unpublish a node that has been flagged as "spam";
  • sending an email to the site administrator when a node is flagged as "spam" more than 3 times;
  • automatically flagging a newly-updated node with a "needs review" flag.

Where do I start?

To start experimenting with this module, go to "Administer » Structure » Flags" (on Drupal 6, "Administer » Site building » Flags"). Make sure that you grant the "administer flags" permission to your administrator role or this menu item will be missing.

Branches

Flag has the following branches. As with most Drupal modules, you cannot downgrade from a higher branch.

  • 8.x-4.x: Under active development.
  • 7.x-3.x: Under active development. Stable release is available.
  • 7.x-2.x: Minimal maintenance (bugs fixed; new feature backport patches committed).
  • 6.x-2.x: Minimal maintenance (bugs fixed; new feature backport patches committed).
  • 6.x-1.x: No longer maintained.

Features added in 3.x

  • Flaggings are entities.
  • Views field and sort for flag status.

Features added in 2.x

  • Flag any entity (7.x-2.x only). Note that some entities have restrictions, and flag links don't show on taxonomy terms due to a core bug).
  • Flagging for anonymous users (even with page caching enabled). Requires Session API.
  • Import/Export support.
  • Faster table indexes and schema.
  • Services module integration (moved to Separate project).
  • Activity 2 module integration (Removed in 2.0 final; see here).
  • More powerful trigger and actions integrations.
  • Flag access controls (flag only others/own content) and access API.
  • Integration with core actions via the "Actions" submodule.
  • Integration with Rules (does NOT need the "Actions" submodule