I have upgraded to the latest dev version.

I have a hierarchy where I have regions (og group) and clubs (og group). The clubs are set to have a parent of a region.

The parent update seems to work and set the parent group. The subgroups block displays the clubs listed under the region as expected.

However, I have some Views that show tables of clubs with the corresponding group using the the 'OG:Group Names' view field. The old groups that I set up (prior to upgrade) display the parent group correctly. The new clubs that I set up do not show the parent group.

I have the same issue with some other views that display clubs on a gmap. The gmap is filtered to only show nodes with the correct group ID but the new clubs do not appear.

I'm not sure how to provide more details. I guess first this is just a question to understand if the integration with Views has in some way been broken?

Comments

amitaibu’s picture

Status: Active » Postponed (maintainer needs more info)

og subgroups has no current integration with the views module. Before 5.x-4 subgroups were written to {og_ancestry} but now they are written to their own table {og_subgroups} - so I have a feeling problem is somewhere there.

Indeed, you will have to provide some more info. Clear screen shots are always a food start :)

rbryer’s picture

Thanks,

Yes this is very broken (which I understand as it is a rewrite). I have tested and I can change the parent of a sub group to a different region but the view still states that it is in the old group (set prior to the upgrade). So while the new table updates are working the module has left details behind in the {og_ancestry} table.

Its really the view integration of OG that has been broken. All I am trying to do is display the name of the Group that a sub-group belongs to. Much is the same way the I could display the name of the group(s) that a story or any other node belongs to.

Is the sub group no longer truly part of the OG group?

Is this on a time-line to be looked at? My whole site is based on OG, OG subgroups and Views ...

rbryer’s picture

Title: Setting parent does not work as expected » OG Subgroups breaks OG Views integration
Priority: Normal » Critical

My situation gets worse. I don't really have a path out of this. Could you explain why you are no longer updating the og_ancestry table? It seems kinda core to the og module. I'm happy to help anyway I can, I'm no PHP expert but have strong software engineering experience in a wide range of other areas. I can certainly poke around in the code and test .

A bit more detail on my current issue.

At the SQL level, this query displays the current hierarchy as I would expect.

SELECT a.parent, ng.title, ng.type, a.gid, nc.title, nc.type 
FROM og_subgroups a, node ng, node nc
WHERE nc.nid = a.gid
AND ng.nid = a.parent
AND nc.type = 'Club'
parent 	title 	type 	gid 	title 	type
66 	Australia 	region 	78 	Albury 	club
66 	Australia 	region 	79 	Erskine Park 	club
66 	Australia 	region 	80 	Pilbara 	club
66 	Australia 	region 	83 	Lock 	club
30 	USA 	region 	98 	Cuba 	club
28 	UK 	region 	19 	Bedford 	club
28 	UK 	region 	87 	Belfast 	club
28 	UK 	region 	88 	Bexhill 	club
28 	UK 	region 	106 	Alloa 	club
28 	UK 	region 	108 	Romford 	club
28 	UK 	region 	121 	Bromley 	club
28 	UK 	region 	130 	Sittingbourne 	club

However, I still have hierarchy data in the og_ancestry table. This has been left over from the the previous version of og_subgroups and this is the only thing keeping some of my views working (which fooled me into thinking everything was okay).

SELECT a.group_nid, ng.title, ng.type, a.nid, nc.title, nc.type 
FROM og_ancestry a, node ng, node nc
WHERE nc.nid = a.nid
AND ng.nid = a.group_nid
AND nc.type = 'Club'
group_nid 	title 	type 	nid 	title 	type
30 	USA 	region 	98 	Cuba 	club
28 	UK 	region 	88 	Bexhill 	club
28 	UK 	region 	87 	Belfast 	club
28 	UK 	region 	19 	Bedford 	club
66 	Australia 	region 	79 	Erskine Park 	club
66 	Australia 	region 	83 	Lock 	club
66 	Australia 	region 	80 	Pilbara 	club
66 	Australia 	region 	78 	Albury 	club

Without updating the og_ancestry table the sub groups are in effect not part of the parent group. I can write a quick SQL script that will fix the og_ancestry table based on the og_subgroups table, but what would the collateral damage be. I need to understand why you are no longer updating the og_ancestry table in the first place.

A small point also. The change in naming conversion og_ancestry.group_nid->og_subgroups.gid is slightly confusing. I'm not sure what the db standards are so I can't comment really on which is correct. And should 'parent' not be parent_nid?

Like I say. Happy to help anyway I can.

amitaibu’s picture

The fact that og_subgroups was writing its data into og's table is simply wrong. The update path of 5.x-4 didn't remove the existing records as it might have been dangerous for existing users.

The fact that the data is separated into two tables doesn't mean you can't query them (SELECT ogh.parent AS gid FROM {node} n INNER JOIN {og_subgroups} ogh ON n.nid = ogh.gid WHERE n.nid = %d" get's data from two different tables).

So what are you missing actually - a views integration (no time line for this) or a tool to remove previous records from {og_ancestry}?

rbryer’s picture

I'm not missing anything. The Views integration of Organic Groups is broken by this module. In my view this makes this module non-compatible with the current version of OG. Which is a significant problem.

Quite simply a SubGroup is no longer part of the Group. It was before. This means that you can't create views that display details from the sub groups of a group. As I stated before you can create a view of all the nodes that belongs to a group as it is maintained in the og_ancestry table. A sub group is still just a node that belongs in the parent.

Also, because the upgrade does not clean up the old data in the og_ancestry table at first glance it appears to still be working. It is only when you start to add new subgroups that you realise that it is in fact broken.

Anyone that is using views with OG that upgrades to this version will suffer the same issue. I understand that you have no plans to integrate Views with this module but you should not break the Views integration of OG.

amitaibu’s picture

Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Closed (works as designed)

Yes, the subgroup info is no longer in the {og_ancestry}. This module doesn't break Views integration in OG, it might break something that was wrong in the first place - For this I'm changing to 'by design'. Now, it's time to understand how to do it right.

I agree that we might need to give users an option to remove old records from {og_ancestry}, I'll fix that.

Just to emphasize, we aren't breaking anything in OG as we are not writing into any of OG tables.

amitaibu’s picture

Just to add to my previous comment. The goal of the rewrite was to separate subgroups from groups, as the nature of OG is flat - no hierarchy.

By setting to 'by deign' I'm not trying to run from this problem, I really want to try an find a solution, but writing into another module's table isn't a proper one.

I'd like to understand more what is your need, and lets try to find the solution together.

amitaibu’s picture

@rbryer, In this commit older records will be deleted (you need to run update number 2).

rbryer’s picture

Okay, I'll try and set up a vanilla install of Drupal, Views, OG and OG Sub Groups so that I can demonstrate this issue and give you access.

The scenario I current have is this:

1. I use OG , OG Subgroups, Views and Panels
2. I have a two group types, lets just call them group and subgroup.
3. I create a group (A) and post content to it, stories etc.
4. I have a Panel (with gets passed a GID for the group) which displays information of the the group node and also panels with details of the posts to that group.
5. I then create several subgroups (X,Y,Z) and set their parent to be the group (A)
6. I need to be able to see the list of subgroups for the given parent by using a view with a filter on Type=subgroup. This would work fine in the old world as the subgroups belonged to the group just like any other node. Now the only thing that knows that the subgroup is a subgroup of group is the subgroups module.

On my live site I actually use this with gmap and location. Each subgroup has a location and displays on a map. Only subgroups that belong to the group are displayed on the group page panel.

To fix my immediate issue: you had previously left the data in og_ancestry. So does it do any harm? Can you think of any nasty side effects from me dumping the hierarchy back into this table as a one off (and temporary fix)?

I still think that you should warn potential users of this issue as it is a significant change over the previous implementation. This version of subgroups does not deliver the same functionality as the previous version. The release note

This is the first official release of the rewrite by Amitaibu which is more stable and better coded than the previous version. Users of the 5.x-3.x version can safely upgrade to this version.

Is not really true. The stable and better coded part certainly is ... but some users can't upgrade safely. Views, Panels and OG seem to be referenced as a powerful group and recommended often so I assuem that I am not the only one that will hit this issue.

I hope this does not sound critical, I certainly don't mean to be, the module seems to work in every other way. I'm very willing to help resolve this anyway I can.

ezra-g’s picture

@rbryer: The rewrite does provide the same functionality. It implements this functionality in a more technically sound fashion, both because it uses its own table for storing group hierarchy and because the overall codebase is much cleaner. There are almost always new issues to be filed, so I don't think the release note was dishonest.

ezra-g’s picture

Also, the rewrite was available for testing before 4.0 was released.

amitaibu’s picture

@rbryer,
Just to make sure I understand. Will an og_subgroups integration with views solve you issue? (i.e filter all groups that their parent is XYZ).

You can keep as a temp fix your data in {og_ancestry} if it works for you.

rbryer’s picture

I certainly didn't mean to imply the statement was dishonest, simply that people that upgrade to this version need to be aware that it works differently and will break any views of a groups sub-groups.

Sub-group nodes are no longer associated with the group in OG (og_ancestry). This means that the standard Views integration of OG will no longer pull out the subgroup nodes along side the rest of the nodes that are associated with the group. You do update og_ancestry when you call og_subgroups_propogate_content() so all nodes other than subgroup will belong to the parent group. Its just the subgroup that does not.

This is a fundamental change. If it is by design then that is fine but we need to be clear that there is not a clear upgrade path. In fact I can't see anyway to replicate the old functionality without changes to the OG module.

I don't see why one module writing to another modules tables in this instance is an issue. OG subgroup has an absolute dependency on OG, so maintaining the relevant OG data is surely a requirement for the module. Interfacing to the module through its og_save_ancestry() function as you have for the content would seem correct to me.

rbryer’s picture

While having a look I just noticed the the pqsql lines in the og_subgroups.install module (line 15, 76) still refer to {og_ancestry} rather than {og_subgroups}.

ezra-g’s picture

Indeed. Thanks.That should be reported in a new issue.

amitaibu’s picture

@rbryer,

1. Group nodes are no longer in {og_ancestry}. The fact they were IMO was a hack.
2. Please answer the question from #12 so we can advance...

rbryer’s picture

We are going is circles here. I still believe that this is a bug and by flagging at as 'by design' it hides it from general view.

1. While you believe this to be a hack it meant that a subgroup was treated the same way as any other node. As a subgroup is just a node, why should it be treated differently.

2. Your question:

Will an og_subgroups integration with views solve you issue? (i.e filter all groups that their parent is XYZ).

Answer:

No. I need to be able to build a view that lists out all the nodes that belong to a group, this includes all the content nodes AND any subgroup nodes ... and any subgroups of those subgroups etc.

amitaibu’s picture

@rbryer,
I agree we are going in circles...

I'd like to conclude this:
1. subgroups will not place invalid data in {og_ancestry}. Invalid as in OG makes sure not to place group nodes there.
2. Yes, it seems you do need this integration. Then you will be able to create a view with all subrgoups and a view with other content and views_fuse them together. I'm willing to look at it.

Again, this is a case of a feature request not a bug.

amitaibu’s picture

rbryer’s picture

Posted here as I don't want to taint the new issue.

I will try and contribute but this is not really the direction I believe that I need to head. As far as I am concerned a subgroup is just content, the same as any other node. I have CCK fields added throughout and I just want it to be a normal node, not a special case. I can't create it as a non-group node as it needs to be able to have members etc (e.g. OG group functionality).

I guess what I really need it an option to 'Treat subgroups as content' which if true would propagate the subgroup-parent mapping into the og_ancestry table just as it does for non-group nodes. If turned off it would delete all the mapping from the og_ancestry table to provide your 'pure group' functionality. I have hacked a SQL fix to do this on my site and this make everything work just fine (views, panels etc).

I understand your option but continue to disagree. Developing separate View integration of subgroups and then requiring views_fusion is unnecessary and over complex, adds unnecessary bulk to this module and duplicates functionality. My views are complex enough as it is without having to combine them together. Reapplying this simple fix makes OG, OG Subgroups and Views & Panels work seamlessly and allows a direct upgrade from the previous version to 5.x-4.0.

I will follow the other thread, to see where you are headed but for now will have move away from these releases, get my PHP manuals back out and start coding again!

ezra-g’s picture

You said, "As far as I am concerned a subgroup is just content, the same as any other node." as well as "I can't create it as a non-group node as it needs to be able to have members etc (e.g. OG group functionality)."

Could you clarify the functionality you are trying to achieve without describing the technical solution (ie database tables)?

amitaibu’s picture

Title: OG Subgroups breaks OG Views integration » Write groups into {og_ancesery} as regular nodes
Category: support » feature
Status: Closed (works as designed) » Active

@Ezra-g,
his need is to see the group nodes under the parent group, as if it where a regular node. I was thinking on it and I can see the logic there.

I'll draw Moshe's attention to this issue, and see his opinion on doing such a thing. In the case subgroups will write to {og_ancestry} it will remove it's data upon uninstall.

Otherwise, a subgroups integration with views will be required.

moshe weitzman’s picture

Title: Write groups into {og_ancesery} as regular nodes » Write groups into {og_ancestry} as regular nodes

This issue was discussed at length when we introduced private groups. At that time, we decided to keep og_ancestry flat. I think thats a good decision, and I'm happy to see this new version of subgroups honor that.

In order to fulfill rbreyer's need, I suggest views fusion or a custom query. Ultimately, Views2 is supposed to handle OR conditions for filters so this will be a native feature soon enough. Feel free to contribute a patch for that.

amitaibu’s picture

Status: Active » Closed (won't fix)

Thanks Moshe,

@rbryer
I'm closing this issue. FYI - http://drupal.org/node/272673#comment-891538

jackspiv’s picture

Hi all,

Thankyou all for the great work to improve this essential module.

*****Warning ... Long Read ... Warning*********
***************************************

I just wanted to chime in on this. I am so glad that I found this thread. Rbryer has a very strong point about the release note". Reading this has made it very clear to me that I cannot safely upgrade to the new version because I depend on the same functionality that rbryer does. I generally do quite a bit of reading of the issues before I make upgrades. In this case i did less reading than usual because of the strong wording of the release note.

"This is the first official release of the rewrite by Amitaibu which is more stable and better coded than the previous version. Users of the 5.x-3.x version can safely upgrade to this version."

I mentally marked this as an upgrade that I would do as soon as I had the chance. I very much want the user and post propagation that 4.x offers. On a whim, I did just a bit more reading before making the plunge and found this thread. Rbryer's experience and adamant expression has saved me, im guessing, at least a day chasing down a problem that I would not have seen until later.

I think that I understand both points of view here. There is no dishonesty and the note may even be "technically" correct. It may not break any functionality of the actual prior OG_Subgroups module version 3.x, however, as Rbryer points out, it very specifically breaks his usecase which much of this thread tries to elicit. He had been able (before the new 4.0 release) to accomplish certain things because of a distinctly valuable way that the previous version interacted with the OG module and then on to the Views module. Now he cannot.

This is a really premier example of where a SYSTEM level functionality is literally "greater than the sum of its parts". The rewrite has successfully (has not broken) replicated previous functionality at the module level. It has, however, by changing its interaction strategy (stopping the write to OG_ancestry tables) removed some very valuable functionality offered by the "intermodule cooperation" of OG_subgroups, OG, and Views. In this case, rbryer's requirements (and actual site) strictly depended on the "intermodule cooperation" for features he was providing to his end users.

This is one of the rare moments where both of the parties in the discussion are actually correct. The rewrite does not break the previous modules functionality AND the functionality actually used successfully by rbryer was in fact broken by the rewrite.

I am writing this level of detail because I hope that it will clarify this complex issue for any who might follow and be tempted unwittingly to update.

As a user, I would be better served if the release note said something like:

"This is the first official release of the rewrite by Amitaibu which is more stable and better coded than the previous version. In general, new users will benefit and most users of the 5.x-3.x version can safely upgrade to this version. However, for some, this upgrade may break views or other functionality that depends on the previous interaction between OG_subgroups, OG, and Views. Research this interaction [#272173: Write groups into {og_ancestry} as regular nodes] , plan your upgrade accordingly, and MAKE BACKUPS"

Also, as a user, I'm nervous about the pro's and con's of keeping the old data in the OG_ancestry table. While it does allow for existing sites to function, it seems (on the surface) to seduce the casual upgrader into thinking things are allright when they are not. This feels important. Maybe it would be better to have a site fail immediately rather than continue to function with a potentially "crippling illness" lurking behind the scenes. I don't have enough of an understanding of whats being done to craft some example scenarios of how this could create some nasty downstream complications for a site. I have a strong gut feeling that someone who understands the architecture, hooks and calls involved could do so. I can only imagine the pain of trying to back out of a problem later when new subgroups with content, users, comments, forums, etc need to be moved back to a v3.x approach. Or determining if views fusion, etc is sufficient to repair the needed functionality.

It seems that all of this could have very great impact for users (including me) and warrants some strong cautionary warnings. On the other hand, it looks like a good way to go if you are doing your site for the first time and have no legacy dependancies.

Thanks for listening.

(and thanks rbryer for your footprints on this trail...)

amitaibu’s picture

Version: 5.x-4.x-dev » 6.x-0.x-dev

@jackspiv,
Let's talk about the 6.x version. What rbryer was missing was a views integration between OG and OG_subgroups, which now exists in Views2. Is there any functionality that you are missing that can be achieved please open an issue about it.

And yes, backing up is always recommended :)