I am working on a number of applications that use OG that will have very large numbers of groups -- possibly hundreds -- and the current UI has several problems once the number gets that high:
- Selecting nodes for a specific audience becomes very awkward, as each group is listed as a check-box.
- The "group" menu item has a huge number of sub-items, but currently cannot easily be coerced into not showing.
- Having an admin assign a user to a group is a multiple step process and is error prone.
- Defaults for new groups aren't easily set. When there's a need for groups to be private from creation time, this can be a serious problem, and it would be nice if it could be "nailed" down somehow to prevent errors.
- There's a need of a node access status that is not public, but higher than a single group, so that items in that status will show in the "groups" page for multiple groups (supergroups? groups of groups?).
This issue is a sort of "catch-all" to point to other issues where one or the other of these issues might be addressed.
I especially need to solve the "group of groups" problem, since I need to have shared content across many group pages. I will open an additional issue for this problem shortly, and link back from this issue.
Rob Thorne
Torenware Networks
http://www.torenware.com
Comments
Comment #1
killes@www.drop.org commentedI think that the newly added autocompletion feature could be used for assigning users to groups and selecting groups to publish to.
For the groups of groups problem I have created a module that allows admins to put groups into a hierarchy. I am attachign it here, it needs some work. Licence is GPL.
Comment #2
killes@www.drop.org commentedhere is the mysql file.
Comment #3
Torenware commentedThat was fast. You're in Oregon right now for OS conference, yes?
I'll take a look at your code and see what I can do with it. Is it 4.6 compatible, or am I going to need to back-port it?
Thanks,
Rob
Comment #4
killes@www.drop.org commentedno, I am not.
the code requires the auto completion patch. There is also an autocompletion module in thox' sandbox that can be used.
Comment #5
Torenware commentedWell, hope you're doing well whereever you are, then.
I'm playing with the code, but frankly don't understand the UI in the admin=>group hierarchy screen. How is that UI used to establish a hierarchy? I see all of the groups that I've created since I activated the module, but it isn't obvious what to use that long empty space for. Listing sub-groups by name? Listing parent groups by name? Something else?
Comment #6
killes@www.drop.org commentedthe field is for adding a group as a subgroup to a parent group. The code is probably not fully working.
Comment #7
Torenware commentedIf it doesn't work yet, it doesn't work yet. I can still give it a hack :-)
How should it work, now that I understand that bit of info? BTW: I'd actually recommend the reverse UI in the case above, since you might have groups with very large number of sub-groups. But let me try it out now that I better understand what you meant.
Comment #8
Torenware commentedLooks like the fields actually does assign a super group; I've looked at the records created in og_hierarchy, and that is consistent with that.
A few more questions about how you believe the code should behave once it works:
I'll probably also factor things a bit, since I'll be calling your code mostly in background anyway, through my own UI.
Thanks,
Rob
Comment #9
Torenware commentedOK, I have your code working, after making a very small modification in og.module that makes it "hierarchy aware": when creating the SQL for getting its "home nodes", og.module now checks to see if the function "og_hierarchy_get_parents" exists, and calls it to get parents groups.
[on second though, perhaps I should call "og_hierarchy_get_parents_all" instead???]
og.module generates slightly different SQL in this case; instead of
it generates something like:
This seems to work, and if I understand Moshe's SQL, it will make sure that the right access checks happen for all of the parent groups as well.
This code definitely needs review, so anybody reading this who wants to use it now, YMMV ;-)
Comment #10
Torenware commentedHere's the og_hierarchy patch as well.
Comment #11
Torenware commentedUpdated patch for og_hierarchy.module. I've added some API functions to allow other modules to manipulate the hierarchy tables:
Comment #12
Torenware commentedNew and improved patch. This one is now working in my site, and is getting some exercise from another module.
Comment #13
moshe weitzman commentedplease describe better what should change in og so that another module could manage the group hierarchy
Comment #14
Torenware commentedThe change in og itself is very simple. All it needs to do is change its notion of a "home node". Currently, you put that logic into og_get_home_nodes_sql(). The function is only called twice, and it's immediately used the generate a db result containing the list of qualifying nodes.
My proposed change:
This is almost the same as your old query, and if I understood your SQL correctly, does the same access checks as the old code did.
I'm not sure how best to generalize the notion of hierarchy, besides having some call get passed the "groups of groups" to which the group in question belongs.
Certainly, there are better notions of relating groups than hierarchy (my own application could nicely use a "taxonomy of groups", for example), but this solution required almost no change in your code, but works very nicely for a simple hierarchy.
Comment #15
sethcohn commentedPlayed with the code, and had to mess with manually patching since the patches didn't apply correct (some were my changes to og, but the heirarchy links above don't sync correctly either.
While this adds a 'sense' of hierarchy, it's fairly invisible (and fairly useless right now as a result).
Subgroups don't show as nodes in their parents.
All groups show up as checkboxes still.
Yes, behind the scenes, it seems better, but in front, where it matter, I didn't see anything warranting this addon (yet)
All in all, I'd much prefer to see a taxonomical approach here. Allow us to assign groups a taxonomy, and use that to tie groups to taxonomy (ala taxonomy association). Allow group picking the same way we pick Taxonomies now (either single, or multiple), with a nice treed dropdown/select box.
Comment #16
moshe weitzman commentedgroups are just nodes, and thus are already able to be categorized and displayed by all our taxonomy_x modules in Contrib
Comment #17
Torenware commentedSeth,
Here's how I'm using this modification, which may make it more clear to you.
Under the default model of og, to post content to a particular group, you must *belong* to the group. Also, you must mark the posting as targeted to that group.
When you need to publish to some large subset of groups, this is not tenable. So the hierarchical patch allows for the following publishing model:
When you have hundreds of private groups where you need to hide even the existence one group for another, I have yet to see another solution that is as simple or as less likely to expose sensitive data to the wrong group of people.
As to Moshe's comment: as you and others have pointed out, the taxonomy access schemes do not play nice with og. Private groups mean private data, and you want an access scheme robust enough that it will actually keep private data private.
So in suggesting to me that I use a compound scheme using both og and taxonomy, I have to ask you: Hishtagaatah? Doesn't sound like too good an idea to me ;-)
Until a better documented, more robust means of combining access schemes is supported, hierarchy of groups strikes me as a lot easier to code and debug, and probably also to administer. With a hierarchical group scheme, you're dealing with only one access scheme. Do you have a better solution that actually works? If so, please describe it. But if you don't, please considering accepting this patch.
This is a group project, and the group has no obligation to accept any particular patch. But this code has been sitting out here waiting for review for a full month now. Is it too much to ask that someone give this code at least a bit of thought? I did. It's only courteous to look it over, especially after this much time.
Comment #18
Torenware commentedSeth,
One addtional point:
While this adds a 'sense' of hierarchy, it's fairly invisible (and fairly useless right now as a result).
Subgroups don't show as nodes in their parents.
Yes. But not useless: I'm trying to prevent subgroups from showing as nodes for their parents. If the code did what you'd like it to do, I would not have written it.
Here's what the code is intended to do.
Suppose you have a family of groups {a, b, c, ...., z} that all belong to a super group S.
The object here is to have some group of admins that belong to S. Non-priviledged users belong to some group in the set of {a,...,z}, take "a" for an example.
A member of "a" should be able to contribute content to the "a" group, but to no other group.
A member of S should be able to contribute content that will be visible to any of the sub-groups.
This turns out to be a very good scheme to target content to some universe of users that are not all users.
It's not a suitable solution to allow users of individual groups to publish up into a super-group of users. But then again, that wasn't the idea.
Comment #19
sethcohn commentedAh, much clearer now. Thank you for the description.
I see the benefits as written:
1. Create a super-group for the set of groups you need to publish to regularly
2. People who need to publish belong to the supergroup and posts to super group appear in all subgroups.
That part works for me. Wasn't clear from anything I'd read on this thread so far, so I didn't notice that was the intent.
Problems as written:
a. Supergroup posts appear (at least with my og node view code, as displayed now) as from supergroup, not subgroup, when viewed in subgroup. Fixable, most likely, by modding the node view.
b. List of checkboxes might stay quite large, if you need to be a member of dozens of groups regardless, since subposts do NOT upwardly propagate (ie post in sub does not appear in super group).
I'm not saying _use_ taxonomies BTW, I'm saying make it look like taxonomies to the rest of the system.
Why not have og's 'tree' be a taxonomy structure? I find the OG hierarchy and 'checkboxes' to be annoying different from taxonomies, when in fact, it's a parallel concept. Reuse the existing taxonomy code if you really can't make it work with taxonomy directly, but at least it's one less user interface hurdle.
> Subgroups don't show as nodes in their parents.
If this was an _option_, it would address problem b above, and make it more useful to some of us.
Now that I see the intent, I can see the usefulness of this approach, I'm just asking for some adjustment in the way it's been userinterfaced.
Comment #20
sethcohn commentedOne clarification:
These are 2 different items/issues -
1) Subgroups (the node representing the _group_) showing up in in the supergroup listing.
(e.g. Displaying SuperGroup listing S, the 'group' nodes a, b, c show up.
2) Subgroup _items_ showing up in the supergroup listing.
(e.g. Displaying Subgroup posts in a, b, c in the Supergroup listings of posts)
I can see the benefit, to having both or either, in different circumstances, and both should be optional.
Comment #21
moshe weitzman commentedI looked over the code, and the change to og itself is small and clever. A couple questions:
- How does this interact with the group admin link 'remove from group'? I assume that no removal can occur because the node has no affiliation with the group in node_access table. The affiliation is with the supergroup. I guess the right thing to do here is to not show this link for supergroup posts. Maybe that happens automatically. I can't test right now. I am hoping one day to allow for a group editor role which has permission to update/delete all group posts. In this case, the group editor would be unable to change supergroup posts. I think thats a feature, but some would surely call it a bug.
- What if you actually click through on a 'read more' link on one of these supergroup nodes? You will get access denied if you are not a member of the supergroup. So how are you managing memberships to supergroups? That seems ugly.
Here is an alternative solution which may or may not be better. Lets discuss a bit and then make a decision
In your helper module (you call this og_hierarchy), you will implement two hooks: nodeapi('form post) and nodeapi('validate'):
NODEAPI('FORM POST')
Here you will add checkboxes where node author chooses supergroups.
NODEAPI('VALIDATE')
Here you read those supergroups and add all children to the $node->og_groups array. Then, og_nodeapi('insert') and og_nodeapi('update') will take care of saving all the node_access entries.
There are a couple open issues with this approach
- you might want to remove the current checkbox selector for selecting groups on the node form. This can be done with CSS?
- you will want to name your module something earlier in the alphabet than 'og'. Thats because you want to modify $node in your nodeapi('validate') before og_nodeapi('validate') sees it.
The upside of this approach is that og is blissfully unaware of supergroups. If a post belongs in a group, there is a corresponding node_access record. The downside is that any group admin could decide to kick the node out of its group, and in the future could even edit the node (which would affect all groups where it appears).
CODE REVIEW
- please provide patches against HEAD. also supply a complete og_hierarchy instead of patches to it.
- if you deprecate a function like og_get_home_nodes_sql(), please remove it.
Comment #22
moshe weitzman commentedAs for og_hierarchy.module, it might be useful to piggy back on the general relationships API that is being discussed and developed at http://drupal.org/node/28480. The code is in clipper.module - http://cvs.drupal.org/viewcvs/drupal/contributions/modules/clipper/clipp...
Comment #23
jasonwhat commentedWhat's the latest on this? Is anybody using this or is there a demo somewhere?
Comment #24
moshe weitzman commentedthere isn't anything actionable here. ui tweaks should be done using form_alter in a contrib module, or in theme css. if og doesn't offer the right places for these tweaks, please reopen with details
Comment #25
singularoSample code/module to tweak the ui for large numbers of groups.
---- module ---
<?php
function og_checkbox_to_select_help($section) {
if ($section == 'admin/modules#description') {
return t('Change og checkboxes to select\'s in erp nodes');
}
}
function og_checkbox_to_select_form_alter($form_id, &$form) {
if (($form['#erp']) and
(is_array($form['og_nodeapi']['visible']['og_groups']))) {
$form['og_nodeapi']['visible']['og_groups']['#type'] = 'select';
$form['og_nodeapi']['visible']['og_groups']['#multiple'] = TRUE;
$form['og_nodeapi']['visible']['og_groups']['#size'] = 5;
$form['og_nodeapi']['visible']['#collapsed'] = TRUE;
}
}
--- install ---
<?php
function og_checkbox_to_select_install() {
db_query("UPDATE `system` SET `weight` = '1' WHERE CONVERT( `filename` USING u
tf8 ) = 'modules/erp/og_checkbox_to_select/og_checkbox_to_select.module' LIMIT 1
");
}
Comment #26
rubenk commentedMosh wrote:
I am still a bit lost. What is the proper methodology to configure og for "groups of groups". If someone has come up with a successful solution, it would be great to post to the handbook or at least to the snippets section. No?
Comment #27
moshe weitzman commentedthere is no notion of groups within groups. see old open iossues for discussion about this,
Comment #28
joe.murray commentedThere are over 300 electoral districts in Canada, and there may be good reasons to set up different groups with different responsibilities in each of them for an NGO or a political party - communications, outreach, policy, etc. There are also 10 provinces, and most political organizing and communications needs to be attuned to the different dynamics in each province. It would be very useful to have groups of groups.
Comment #29
moshe weitzman commentedthanks ... everyone agrees this would be useful. but noone can be bothered it seems to spec out the details of this feature.
Comment #30
Torenware commentedJoe --
I've come to the general conclusion that the solution is to use og for this purpose very sparingly, or not at all. It's really the wrong tool for the job.
Part of the reason for this has been the way that CiviCRM uses Drupal roles to map to CiviCRM groups, which are very different from Drupal organic groups. CiviCRM can handle hundreds of groups. But Drupal really can't handle hundreds of roles, nor can OG handle hundreds of groups particularly well. OG also is very difficult to tie to an external resource like records in an LDAP or CRM contact store. Neither system is designed for these purposes, nor do I believe that either system will move in a direction that would permit it. I've given up the fight to push them in this direction.
Keep an eye on my work with the Green Party Of Canada. I believe it will prove a better solution to this problem than our previous efforts at making og CRM aware.
Comment #31
moshe weitzman commentedI don't agree with all of that analysis. OG runs fine with hundreds of groups. Groups are just nodes. Thats like saying Drupal can't handle hundreds of nodes. groups.drupal.org is running smoothly with hundreds of groups ... This issue has covered lots of different issues. I prefer we start a new issue for subgroups because this one started as some UI request.
Comment #32
kclarkson commentedI am also working on a site that going to have a large number of groups. I stumbled upon this post and it appears the conversation went a different direction.
I would like to change the group audience selection to either a dropdown or an autocomplete.
Thanks
Comment #33
Grayside commentedThis issue is really old. Please create a new feature request. As you say, most of this thread is not valuable required context for any discussion of adding autocomplete to og_form_add_og_audience().