Got this error when enabling token dev. version (as of feb 8 2011).

Notice: Undefined index: subscription in _token_build_tree() (line 737 of /home/www/p11.voxel.dk/sites/all/modules/token/token.module).
Warning: Invalid argument supplied for foreach() in _token_build_tree() (line 737 of /home/www/p11.voxel.dk/sites/all/modules/token/token.module).

Any ideas

Thanks

Comments

Dave Reid’s picture

Project: Token » Notifications

This bug is because the Notifications module defines a token type but not any tokens for it under certain circumstances:

/**
 * Implements hook_token_info().
 */
function notifications_token_info() {
  $types['subscription'] = array(
    'name' => t('Subscriptions'), 
    'description' => t('Tokens related to notifications subscriptions.'), 
    'needs-data' => 'subscription',
  );
  $tokens['user']['unsubscribe-url'] = array(
    'name' => t("Unsubscribe URL"), 
    'description' => t("Signed URL for cancelling all user subscriptions."), 
  );
  return array('types' => $types, 'tokens' => $tokens);
}

There should ast least be $tokens['subscription'] = array() to prevent this.

lloydpearsoniv’s picture

subscribe

cherokeedude’s picture

Subscribing...

pjcdawkins’s picture

Subscribing. By the way, when I disable the Notifications module these errors do disappear, and I'm using Notifications 7.x-1.0-alpha1.

lloydpearsoniv’s picture

my errors disappeared when i applied

$tokens['subscription'] = array()

as mentioned in #1

Oceanman’s picture

+

dotist’s picture

subscribe

webankit’s picture

+ where should I add this line: $tokens['subscription'] = array()

webflo’s picture

Status: Active » Fixed

Commit cbf35c0 on 7.x-1.x like Dave Reid suggested. Thanks!

Status: Fixed » Closed (fixed)

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