$role) { foreach ($all_tokens['tokens'] as $category => $tokens) { // Check to see if all tokens are enabled for this category. $allow_all = variable_get('token_insert_' . $rid . '_all_tokens_' . $category, FALSE); if (!$allow_all) { $allowed_options = variable_get('token_insert_' . $rid . '_used_tokens_' . $category, array()); } else { variable_set('token_insert_' . $rid . '_used_tokens_' . $category, array()); continue; } foreach ($tokens as $token => $description) { $full_token = '[' . $category . ':' . $token . ']'; if (!empty ($allowed_options)) { if (isset($allowed_options[$token]) ) { $allowed_options[$full_token] = $allowed_options[$token] ? $full_token : 0; unset($allowed_options[$token]); } } } variable_set('token_insert_' . $rid . '_used_tokens_' . $category, $allowed_options); } } }