Hi,
Im not sure whether I should be expecting this or I might be doing something wrong.
When I am logged in as admin, and I create a new case (CT speak) within a group (OG speak) it always defaults to the current group (OG speak). If a non admin user creates a case (CT speak) with a group (OG speak), it does not default to the current group (OG speak).
Is it be possible to:
1. Default to current group if user is non admin (am I doing something wrong)
2. Always default to the current group and remove the group selection fieldset, as I dont want users to really be able to choose any other groups. Or perhaps limit the choice to the groups the are the admins of. (I see in the module code, it does mention this, but as I cannot get the first point to work, im guessing it will always default to first group and not the current group)
Any help would be appreciated.
Kind Regards
Charles
Comments
Comment #1
charles.holtzkampf commentedMore information:
As admin:
I can use the Node create links in the Gropu Details Block OR the add task link with the group node itself, both default to the current group
As a non admin:
When using the add task link within the group node itself it works, but when using the add case within the group details block it doesn't seem to pickup the current group as the default project.
Difference in URL is as following
Group details block - http://*******************/node/add/task?gids[]=57
Case Tracker link with node - http://****************/node/add/task/57
Comment #2
charles.holtzkampf commentedI've managed to get this working, by doin the following. Definitely not best practice, but will do for now.
In og.module, where it specifies the og_create_links for all node types, I added the /$group->nid after the URL string. Code below. Sorry I am not a programmer, so its the best I can do. Adding this code seems to resolve the issue.
// $group is an object containing a group node.
// TODO: Make this a proper menu
function og_og_create_links($group) {
global $user;
$post_types = og_get_types('group_post');
$types = node_get_types();
foreach ($post_types as $post_type) {
// We used to check for node_access(create) but then node admins would get a false positive and see node types that they could not create.
// When this becomes a proper menu in D6, we get sorting for free
$type_name = $types[$post_type]->name;
$type_url_str = str_replace('_', '-', $post_type);
if (module_invoke($types[$post_type]->module, 'access', 'create', $post_type, $user)) {
$links["create_$post_type"] = l(t('Create !type', array('!type' => $type_name)), "node/add/$type_url_str/$group->nid", array(
'attributes' => array('title' => t('Add a new !type in this group.', array('!type' => $type_name))),
'query' => "gids[]=$group->nid",
));
}
}
Comment #3
boobaaAre you sure the problem of yours mentioned in OP is caused by CTOG, and not CT or OG themselves? Please give this a try by disabling CTOG and trying to achieve the same you have mentioned in #1. If the problem still persists, move this issue to the correct project (CT or OG), since that means it has nothing to do with CTOG.
I can't really follow your paste in #2, but it seems that one emphasizes my concern stated above, since you were not touching CTOG code, weren't you?
Comment #4
charles.holtzkampf commentedHi,
I upgraded my OG module to the latest and that has fixed the issue. Thanks for the respsonse and great module :)
Comment #5
boobaaWhoops, you have forgotten to close the issue. ;)