Organic Groups integration?

Rosamunda - March 25, 2009 - 15:28
Project:Unique field
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Could it be possible for this module to integrate with OG?
Something like

Choose the scope for the unique values:
Content type
...
Content type per organic group
...

Thanks!!
Rosamunda

#1

Rosamunda - March 26, 2009 - 18:57

Nobody interested in this to +1 it?

#2

EdinburghRob - August 27, 2009 - 21:22

+1 I could do with this.

#3

Tarsjusz - October 30, 2009 - 12:11

+1

#4

Tarsjusz - November 22, 2009 - 10:48

I needed this feature so I did something on my site: http://tarsjusz.pl : Each OG has node-type, that titles must be unique. Here is what I did with unique(...).module (this is just dirty code fragment, just to give some clues if you need to do it on your own).

diff unique_field.module unique_field.module_oryginal
26d25
< define('UNIQUE_FIELD_SCOPE_TYPE_OG', 'type_and_og');
69,70d67
<    // drupal_set_message("<pre>" . print_r($node, TRUE));
<
163c160
<           $match = unique_field_match_value($field, $values, $scope, $node->type, $node->language, $node->og_groups);
---
>           $match = unique_field_match_value($field, $values, $scope, $node->type, $node->language);
237c234
< function unique_field_match_value($field, $values, $scope, $ntype = NULL, $nlanguage = NULL, $ngroup = NULL) {
---
> function unique_field_match_value($field, $values, $scope, $ntype = NULL, $nlanguage = NULL) {
241d237
<   $group_tbl = false;
321,327c317
<   }
<
<   else if ($scope == UNIQUE_FIELD_SCOPE_TYPE_OG && is_string($ngroup)&& !empty($ngroup) && is_string($ntype) &&  !empty($ntype)) {
<     $qwhere .= "AND og_ancestry.group_nid = '". db_escape_string($ngroup) ."' ";
<     $qwhere .= "AND node.type = '". db_escape_string($ntype) ."' ";
<     $group_tbl = true;
<   }
---
>   }
334,337d323
<   if ($group_tbl) {
<     $q .= 'LEFT JOIN og_ancestry og_ancestry ON node.nid = og_ancestry.nid ';
<   }
<
394d379
<       UNIQUE_FIELD_SCOPE_TYPE_OG => t('Content type & OG'),

Hope it helps someone.
However, og intergration in module would be definately a good idea.

#5

Rosamunda - November 23, 2009 - 15:36

Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.