This page lists the API changes and upgrading instructions to migrate from Views Bookmark to Flag module.

Upgrading Instructions

Before starting any upgrade, backup your database before upgrading. During this process, Views Bookmark or Flag tables will be modified directly.

Upgrading from Views Bookmark (Drupal 5) to Flag (Drupal 5)

  • Remove the "views_bookmark" folder from your modules directory.
  • Download the Flag module for Drupal 5.
  • Place the "flag" module directory in your site's modules directory.
  • Enable the Flag module at admin/build/modules. Flag will automatically disable Views Bookmark, and move all data over to Flag. Views stored in the database will also be updated to use Flag instead of Views Bookmark.

Upgrading from Views Bookmark (Drupal 5) to Flag (Drupal 6)

  • Remove the "views_bookmark" folder from your modules directory.
  • Continue using the instructions below for upgrading Flag (Drupal 5) to Flag (Drupal 6).

Upgrading from Flag (Drupal 5) to Flag (Drupal 6)

  • Download the Flag module for Drupal 6.
  • Place the "flag" module directory in your site's module's directory.
  • Enable the Flag module at admin/build/modules. Flag will automatically move all data over to Flag. Views will not be automatically upgraded
  • Go to admin/build/views/tools/convert, and individually import your old views into Views 2. Flag will automatically upgrade all of its fields contained in the view.

API Changes

  1. "Name" Property Added to Flags. The new "name" property is now used in all API function calls, views, and tokens instead of the previous VBID. During the upgrade, Flag attempts to create reasonable names for all flags based on their title, however, these may need to be updated after the initial upgrade. English, single-word names are recommended, as the name will be used in URLs and theme function names.
  2. Public API Functions. All the function names in Flag are now prefixed with flag_ instead of views_bookmark_. The following function calls will need to be updated.
    • views_bookmark_mark => flag
    • views_bookmark_get_bookmark => flag_get_flag
    • views_bookmark_get_bookmarks => flag_get_flags
    • views_bookmark_get_counts => flag_get_counts
    • views_bookmark_get_user_flags => flag_get_user_flags
    • views_bookmark_get_node_flags => flag_get_content_flags
    • hook_views_bookmark_api => hook_flag
  3. Parameter $content_type Added to All API functions. In all API functions, an additional parameter has been added to every function, $content_type. This will be "node" in all cases, but eventually may support "comment" or other types of content.
  4. Returned data from flag_get_counts() changed. The function views_bookmark_get_counts() previously returned an array of all count totals a single piece of content. The data structure returned looks as such:
    Array (
        [1] => Array (
                [type] => Bookmarks
                [count] => 22
            )
    
        [2] => Array (
                [type] => Favorite
                [count] => 12
            )
    )
    

    Now that flags have unique names, the "type" property is no longer necessary to describe what flag the count represents. The "name" property is now the key, and the value is simply the count. The new structure looks like this:

    Array (
        [bookmark] => 22
        [favorite] => 12
    )
    
  5. CSS Class Names. In Views bookmark, links were given the class views_bookmark_mark_[vbid] and views_bookmark_unmark_[vbid]. In Flag, the classes are simplified to flag-[name] and unflag-[name].