node relativity and organic gruops integration (small step)
| Project: | Node Relativity |
| Version: | 5.x-2.4 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Hi
I'm trying to integrate organic groups with node relativity. It works quite fine. The only problem is the creation of child, using node relativity, where the new added child actually is not part of the group. It seems that node relativity does not provide gids [] argument.
this is my solution of the problem - patch of relativity.module
- 1613 +1613
if ($may_create && node_access('update', $parent)) {
- $items[] = l(t('Attach existing !type', array('!type'=>$type_name)), "relativity/listnodes/$type/parent/$parent_nid", array('class' => 'relativity_attach_' . $type));
+ $items[] = l(t('Create new !type', array('!type'=>$type_name)), "node/add/$type/parent/$parent_nid", array('class' => 'relativity_create_' . $type), "gids[]=$parent_nid");
}
In view of the idea of node relativity the passing of the parent_nid is actually passing of the nid
Hope the patch works (it does to me). I'm totally new in PHP and programming

#1
#2
In a way my patch is working only in this case
Group node (parent)
> Create new node (relativity) (child) (keep the group)
As a second tasks is to implement attachment of descendants
Group node (parent)
> Node (child > parent)
> Create new node (relativity) (child) (keep the group)
It will require that the group id is taken instead of parent_nid
#3
Hi
After some testing it is the new patch related to the integratrion between node relativity and OG groups. The patch actually does not use anymore parent_nid as a direct input for creating of new node. It gave enormous flexibility, so that every new attached node (relativity function) automatically belongs to the group where the parent node belongs. E.g. we have group Company; we create company X (through OG groups) so that this company belongs to the group dealing with companies. Now we wish to create node Order to the company X (if we use only OG than the company X should be also group, which creates some problems related to the access to the company). In order to do this we use Relativity (patched as shown under), where the newly cerated order belongs to the group company. In general it allows to call in a simple way all orders from the group company, where there is specific parent relations with the specific group post. In this way we have bridge between group post and groups (missing part in OG groups) and more important automatic regime of creating of new nodes.
1610 / 1620
if ($may_create && node_access('update', $parent)) {
$result = db_query("SELECT group_nid FROM {og_ancestry} WHERE nid = $parent_nid");
if ($result) {
if (mysql_num_rows($result)) {
$row = mysql_fetch_assoc($result);
$items[] = l(t('Create new !type', array('!type'=>$type_name)), "node/add/$type/parent/$parent_nid", array('class' => 'relativity_create_' . $type), "gids[]=$row[group_nid]");
}
}
}
// only show link to attach existing node when the potential child doesn't require a parent.
#4
subscribing
#5
so are you only able to add groups now as children or any types in addition to groups?