hey

i'm using Flag 2.0-beta3 on drupal 6.

Reportedly the API has changed:

Update
The flag notforsale is currently using the Flag API version 1, which is not compatible with the current version of Flag. You can upgrade this flag by pasting the below code into uc_notforsale_flag_default_flags() function in the uc_notforsale.module file.
Flag exports: 

$flags = array();
// Exported flag: "Not for sale".
$flags[] = array (
  'content_type' => 'node',
  'name' => 'notforsale',
  'title' => 'Not for sale',
  'global' => true,
  'types' => 
  array (
    0 => 'product',
  ),
  'flag_short' => 'Remove from sale',
  'flag_long' => '',
  'flag_message' => 'This product is no longer available in the store.',
  'unflag_short' => 'Make available for sale',
  'unflag_long' => '',
  'unflag_message' => 'This product is now available in the store.',
  'unflag_denied_text' => '',
  'link_type' => 'toggle',
  'roles' => 
  array (
    'flag' => 
    array (
      0 => '2',
    ),
    'unflag' => 
    array (
      0 => '2',
    ),
  ),
  'show_on_page' => false,
  'show_on_teaser' => false,
  'show_on_form' => true,
  'access_author' => '',
  'i18n' => 0,
  'status' => false,
  'locked' => 
  array (
    'name' => 'name',
    'global' => 'global',
    'status' => 'status',
  ),
  'module' => 'uc_notforsale',
  'api_version' => 2,
);
return $flags;

so the code needs to be updated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lpalgarvio’s picture

FileSize
4.73 KB

updated for v1.4:

$flags = array();
// Exported flag: "Not for sale".
$flags[] = array (
  'content_type' => 'node',
  'name' => 'notforsale',
  'title' => 'Not for sale',
  'global' => true,
  'types' => 
  array (
    0 => 'product',
  ),
  'flag_short' => 'Remove from sale',
  'flag_long' => '',
  'flag_message' => 'This product is no longer available in the store.',
  'unflag_short' => 'Make available for sale',
  'unflag_long' => '',
  'unflag_message' => 'This product is now available in the store.',
  'unflag_denied_text' => '',
  'link_type' => 'toggle',
  'roles' => 
  array (
    'flag' => 
    array (
      0 => '2',
    ),
    'unflag' => 
    array (
      0 => '2',
    ),
  ),
  'show_on_page' => false,
  'show_on_teaser' => false,
  'show_on_form' => true,
  'access_author' => '',
  'i18n' => 0,
  'status' => false,
  'locked' => 
  array (
    'name' => 'name',
    'global' => 'global',
    'status' => 'status',
  ),
  'module' => 'uc_notforsale',
  'api_version' => 2,
);
return $flags;

confirmed to be working after patching.
replaced .module file included.

lpalgarvio’s picture

Status: Active » Needs review
joachim’s picture

Category: bug » task
Priority: Critical » Normal

Thanks for letting me know.

I'll start a 2.0 branch soon to follow changes in Flag 2.0.

lpalgarvio’s picture

made a patch for v1.4

submiting it plus the resulting modified .module file and a tar.gz packing everything

joachim’s picture

Thanks for looking further into this.

The indentation is wrong on the new code in the patch...

lpalgarvio’s picture

i copy-pasted what Flag v2 module suggested (which did work).
i don't know the coding standards, but i'll look into them sometime later.

lpalgarvio’s picture

had forgotten about this.

fixed.

Todd Zebert’s picture

subscribe

mariagwyn’s picture

uploaded modified code, seems to fix problem. A release?

joachim’s picture

Status: Needs review » Fixed

Yes, good point :)

Though I note that Flag 6.x-2.x is still in beta! Don't blame me if it all blows up...

Issue #908358 by LPCA: Changed Flag API has changed.

joachim’s picture

Version: 6.x-1.4 » 6.x-2.0-beta1

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.