Hi,

Is it possible to have a standard group post in multiple group with spaces ?
For instance I have an event content type provided by a feature, and I would like to be able to assign an event node to one, many, or no group.

Is this possible ?

Thanks.

Comments

SpriteGF’s picture

I have that same question. From all the posts I've come across (on drupal.org and on OpenAtrium), Spaces clobbers Organic Group's Audience functionality so you can't post across multiple groups.

SpriteGF’s picture

The exact line in Spaces 2 beta is here. I'm wondering if we can comment this out or set this value to 1 to re-enable audience checkboxes so we can at least cross-post.

http://drupalcode.org/viewvc/drupal/contributions/modules/spaces/spaces_...

line 436: $conf['og_audience_checkboxes'] = 0; // Disable audience checkboxes.

magicyril’s picture

Status: Active » Needs review
StatusFileSize
new2.57 KB

I looked at line 436 but in fact it's just an override of variable_get setting.

So, I hacked the module to try to make it work with multiple groups. Here is a patch. It seems to work, but becareful it's my very own version, I would like to have a code review because I think some part were usefull and I commented them.

SpriteGF’s picture

Thanks for posting this, magicyril! I decided that I'm not going to touch Spaces for the time being (too many traps) and just stick with Organic Groups and customizing the interface with themes and Panels. I'm noticing others are also trying to get back Organic Group Audiences here: https://community.openatrium.com/issues/node/48

I think, by design, Spaces tries to pidgeonhole content into a particular group so that it can show just that group's information. I also read that the author is trying to avoid access issues where a post is in a private Space/Group, but also assigned to a public Space/Group.

that0n3guy’s picture

Just fyi I think this post is also related to this:
https://community.openatrium.com/issues/node/64

Just thought I would let ya know.

that0n3guy’s picture

I tested this patch on Open Atrium 1.0-beta3.2. It works pretty good except for the views support is kinda funky.

Example on the homepage (yoursite.com/home). It shows the post twice, once for each group, this isn't really that big a deal. The bigger problem is that clicking either node link goes to the same location even though one should be in group1 and the other in group2. So if a user doesnt have access to to group1, and both links go to group1, he/she can't access it that way.

If the user clicks into the group first... the clicks the link to the node. It works.

That seems kinda confusing so maybe this will help explain:
I am in group1 and post a node and want group1 and group2 to be able to see it. The link to this node is mysite.com/group1/node/53.

People already IN group 2 can link to it and their url is: mysite.com/group2/node/53

People at home (mysite.com/home) see a url that looks like: mysite.com/node/53 and are sent to mysite.com/group1/node/53. This is bad if the user isn't in group1. They have to click into group2 then click the link to access it.

that0n3guy’s picture

Just so ya know, the patch at #3 offers very similar functionality as this: https://community.openatrium.com/issues/node/48#comment-2383 . But the one one that uses OG_audience is a "lesser" hack I think :).

-Peter

mbria’s picture

Thanks Peter to show that we were duplicating efforts.
I'm always unsure if I need to follow openatrium isuetracker or drupal modules.

You are right saying that my approach with the patch published in https://community.openatrium.com/issues/node/48#comment-2383 is more a hack than a patch, but reviewing what og_spaces was doing I didn't see much choices.

Any case, the patch published here looks cleaner than my dirty hack so please, forget my initial work and let's follow with this thread.

I will love to see OpenAtrium letting you select use OrganicGroups or OpenAtrium set of privileges.
In other words... I don't know why OpenAtrium overwrites privileges instead of giving a choice.

m.

that0n3guy’s picture

Well, for now I'm going to go with this patch. I NEED multigroup for Open Atrium to even be useful for me. Its either that or I build a site myself but thats to much work/time for now.

If node referencing to nodes outside a group worked ( see this issue http://drupal.org/node/696142 ) then multigroup might not be so important... but it doesn't.

that0n3guy’s picture

Also, with this patch at #3, I get this error when creating a node (ie. node/add/book or node/add/page) but not when editing a node.

warning: array_keys() [function.array-keys]: The first argument should be an array in /var/aegir/platforms/atrium-1-0-beta3-2/sites/teamdev.mysite.com/modules/spaces/spaces_og/spaces_og.module on line 883.
jacobson’s picture

I believe the problem cited in #10 with the patch at #3 is in this line:

 $default_gid = array_keys($form['#node']->og_groups_both);

When a new book page is created, $form['#node']->og_groups_both is empty and so is not an array. I don't know how to write the code, but I think we just need to test if this element has any value, and if so, whether it is an array. If it is an array, the above code should not cause a warning. If it is not an array, then the assignment statement would be:

$default_gid = key($form['#node']->og_groups_both);

I think.

HAJ

jacobson’s picture

Well, I took a crack at coding this, and here's what I came up with:

    // Node preview handling
    if (!empty($form['#node']->spaces_og['gid'])) {
      $default_gid = $form['#node']->spaces_og['gid'];
    }
    else if (is_array($form['#node']->og_groups) && count($form['#node']->og_groups)) {
      /*
      reset($form['#node']->og_groups);
      $default_gid = key($form['#node']->og_groups);
      */
      //Following if statement added by HAJ to correct warning
      //from patch in http://drupal.org/node/671032
      if (!empty($form['#node']->og_groups_both)) {
        if (is_array($form['#node']->og_groups_both)) {
          //Below is original line before HAJ edits
          $default_gid = array_keys($form['#node']->og_groups_both);
        }
        else {
          $default_gid = $form['#node']->og_groups_both;
        }
      }
      //End of edits by HAJ

Sorry, I don't know how to create a patch file. Also, be careful as I am quite a novice at PHP and Drupal coding. Use at your own risk.

jacobson’s picture

One problem with my code is that the groups list box does not have pre-selected the current group when a new book page is being created. I don't know how to determine the current group, but hopefully someone who knows more can add that bit of functionality.

Thx.

that0n3guy’s picture

jacobson... i only have a couple minutes so I havent looked at your code yet, but I think you can do:

$space = spaces_get_space();
$gid = $space->sid;

to get the current gid.

-Peter

glennpratt’s picture

Version: 6.x-2.0-beta6 » 6.x-3.0-beta3
Component: Miscellaneous » Code
Category: support » feature
Status: Needs review » Needs work
StatusFileSize
new3.83 KB

I'm guessing if this is going to change, it needs to change on the latest branch.

Ugly patch for 6.3.x, I wouldn't recommend using it, just posting to get it out there.

nedjo’s picture

Raul Gonzales’s picture

Example on the homepage. It shows the post twice, once for each group, this isn't really that big a deal.

Grayside’s picture

I think #828416: Enable multiple spaces per item--spaces_taxonomy implementation is definitely the way forward on this. I was about to post something about Primary/Canonical group audience when I saw nedjo's link.

It would be useful if interested parties could review that discussion and come back with the differences between Taxonomy and OG that need to be thought about here to adapt the concept.

By #764444: Set audience for comments, comments can be isolated per-group using http://drupal.org/project/nodecomment.

kepford’s picture

There is a module that might meet your needs to post to multiple groups while using spaces module. OG Audience

Grayside’s picture

Just by reading the description of OG Audience, I would say all it provides is some nice UI elements in some new places to help set the audience. Unfortunately, that is a comparatively trivial problem to multi-group posts with Spaces.

For example, this scenario:
Suppose a post is in multiple groups, but not all groups have the same set of features related to that post enabled. There is at least one public group, with more features enabled, and thus more information available. How does the user find that "better" post?

kepford’s picture

That is a very good point. I'm also concerned that the module has not been updated since July and it is still a Dev for Drupal 6.

glennpratt’s picture

I apologize, I haven't had much time to investigate the other thread.

It looks like they spent more time worrying about canonical paths, etc. In our usage, it's actually very rare for the url not to be rendered with the desired PURL intact, so round robin, canonical, etc haven't been a concern.

One wrinky for OG I'd like to address is giving preference to groups the current user is a member of, but I just haven't had time to go down that path.

Reroll with less junk and an on/off variable, with no admin interface to set it yet...

socialnicheguru’s picture

This patch worked for me. I was searching hi and low for a solution to VBO and OG. I didn't realize until hours of surfing that it might have all to do with spaces_og and purl.

I have cross posted to http://drupal.org/node/3129886 since it was a similar issue.

foredoc’s picture

Any reason why spaces og disable this audience option?

Thanks.

pdrake’s picture

Status: Needs work » Reviewed & tested by the community

The patch in #22 worked great for me on 6.x-3.1.