Problem with "og_content_type_usage" update strategy

Created on 21 January 2011, almost 14 years ago
Updated 28 October 2024, about 2 months ago

I have a custom module, and in:
mymodule_node_type($op, $info)

I use:
og_get_types('group_post'), to retrieve the node types used as standard group post.

Now, I have content type: type_a, and type_b, which are set to be standard group post.

However, if I step into: admin/content/node-type/type_a, and click "save content type" without any modification, the function : og_get_types('group_post') in mymodule_node_type($op, $info) only returns type_b.

The reason lies in:

function og_node_type($op, $info) {
  switch ($op) {
    case 'delete':
      variable_del('og_content_type_usage_'. $info->type);
      variable_del('og_max_groups_'. $info->type);
      break;
    case 'update':
      if (isset($info->old_type)) {
        variable_del('og_content_type_usage_'. $info->old_type);
      }
  }
}

No matter I modify type_a or not, when I click "save content type", $info will always have $info->old_type = type_a, so the usage will be deleted by :

if (isset($info->old_type)) {
        variable_del('og_content_type_usage_'. $info->old_type);
      }

Thus, in my hook_node_type, even though the group usage for type_a has not been changed, og_get_types('group_post') will not be able to retrieve type_a.

Will this be considered as a bug of og module? Is there a better replacement for the following:

if (isset($info->old_type)) {
        variable_del('og_content_type_usage_'. $info->old_type);
      }

Thanks.

πŸ› Bug report
Status

Closed: outdated

Version

2.1

Component

og.module

Created by

πŸ‡ΊπŸ‡ΈUnited States foredoc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024