Somehow, there are recursions happening. I don't know how this happens, but there are lines appearing in the database having nid and group_nid set to the same value, meaning that a group is its own parent. One cannot remove this relationship via the edit form and the tree and members view break badly.

There should at least be some check in place that nid and group_nid cannot be the same.

Comments

nath’s picture

It is happening in og_subgroups_save_family somewhere in this part of code:

      foreach ($this_tree[$family_type] as $this_key => $this_value) {
        $my_member = node_load($this_key);
        if (!og_is_omitted_type($my_member->type)) {
          $gid = $this_key;
          $sql = "INSERT INTO {og_ancestry} (nid, group_nid, is_public) VALUES (%d, %d, %d)";
          db_query($sql, $this_node->nid, $gid, $this_node->og_public);
        }
      }
ezra-g’s picture

Title: Recursion happening » Group should not subgroup of itself

I'll look into this. Are there any particular steps you can follow to consistently recreate this issue?

nath’s picture

With every edit of a subgroup, a new DB entry is added where the subgroup is a subgroup of itself.
My temporary solution was to comment out the whole codeblock I posted. There don't seem to be any negative side-effects, so I'm wondering what this codeblock is supposed to do.

ezra-g’s picture

Can you describe your group hierarchy and the group you are saving? I believe that this could be happening but I have not seen this happen before. Is it possible that you had post propagation set for one direction and then for another?

nath’s picture

I believe we only had the post propagation set to show parent posts in subgroups.
As for our hierarchy: It happened as soon as we had one parent and one subgroup.

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Please try clearing out the erroneous values from the database and report whether this happens again.

ezra-g’s picture

If you'd like help with that step I could walk you through it.

nath’s picture

Status: Postponed (maintainer needs more info) » Active

Well, I did this multiple times. They are back, as soon as a group is edited.

gravit’s picture

I also have this issue - after a clean install of this release, and creating two groups with no content in them.

Then assigning one group to be a child of another caused the child group to show up as a child of itself in the "river of news" view.

example: going to the child group page shows the teaser for the child group page in its view.

I had node propogation turned on going "down"

ezra-g’s picture

@radscientist: Thanks for pointing out that you had propagation set to 'down'. That information allowed me to re-create the problem. I'll find out why this is happening.

nath’s picture

As I pointed out, the trouble seems to be within that part of code that I posted. I have commented out that part and since then we don't have the trouble and everything seems to work as it should.

nath’s picture

Version: 5.x-3.0-dev » 5.x-3.3

Still happening with 3.3 when post propagation set to "down". Without propagation it doesn't happen.

ezra-g’s picture

@nath: I'm not sure that just commenting out that block of code is an acceptable solution. It seems like we'll need to make post propagation smarter. I hope to work on this this week as I continue clearing out the queue for this module. If you'd like to propose a solution and describe the testing you performed to make sure it doesn't cause other errors, I would be open to hearing it.

ezra-g’s picture

Status: Active » Fixed

I believe this is resolved by the 5.x-4.0 version.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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