I had a post type called Project and another called Project Ldn. My groups were configured within OGCTA so that only one post type could be posted in each group. However the post type available within a group via the OG group block was not always the one set through OGCTA.

I found the source of the bug at around line 958 in og_content_type_admin.module in fn og_content_type_admin_block_details(). Here are the original code that uses a string comparison function and my replacement code that uses a regular expression instead. Please excuse me. I haven't yet yet learnt how to do a patch.

 // ORIGINAL CODE
      $types = node_get_types();
      //sift through the links returned and remove the restricted content types
      foreach ($types as $type) {
        foreach ($links as $link => $value) {
          $link_test_text = t('Create !type', array('!type' => $type->name));
          if (strstr($value, $link_test_text) && ($activated_types[$type->type] == DEACTIVATED) && (!_og_content_type_admin_is_admin_content_access_nid($node->nid))) {
            unset($links[$link]);
          }
          if (strstr($value, $link_test_text) && ($allowed_types[$type->type] == NOT_ASSIGNED_TO_GROUP) && ($user->uid != 1)) {
            unset($links[$link]);
          }
        }
      }
 // MY ALTERNAITIVE CODE
      $types = node_get_types();

      //sift through the links returned and remove the restricted content types
      foreach ($types as $type) {

	  // Make a regular expression to match link text for adding a node of the current $type.
        $create_type =
          '#.*>' .t('Create !type', array('!type' => $type->name)) . '</a>$#';

        foreach ($links as $link_key => $link_val) {

		  $matches = array(); // for debug only

          // Determine whether the current link is for adding a node of $type.
          $is_add_type = 0 < preg_match( $create_type, $link_val, $matches);
          $is_deactivated = $activated_types[$type->type] == DEACTIVATED;
          $is_admin_access = _og_content_type_admin_is_admin_content_access_nid($node->nid);

          if ($is_add_type && $is_deactivated && !$is_admin_access) {
            unset($links[$link_key]);
          }

          $is_not_assigned_to_group = $allowed_types[$type->type] == NOT_ASSIGNED_TO_GROUP;

          if ($is_add_type && $is_not_assigned_to_group && ($user->uid != 1)) {
            unset($links[$link_key]);
          }
        }
      }

Comments

schnippy’s picture

I created a patch file from your solution (below) and will try it against my dev site to see if it works for us, thanks for submitting.

I ran into the same problem and came up with an alternative solution to fix how the module is searching and matching the group permissions here:

http://drupal.org/node/697826#comment-2759060

schnippy’s picture

Status: Active » Needs review

Correcting status of this patch to -> needs review.