Missing OG Context on Translation Links (gids[]=##)

Background / Setup: Site has multiple groups using Organic Groups and multiple Language translations using i18n. Each group node can be translated by group members.

Problem: When translating nodes using the Translate tab on an organic group node, the links do not include the "gids[]=" parameter needed to keep the current group context on the node add page. If the original node has a group context, the translated nodes should too.

I consider this a bug because I think both these modules are big and popular enough that they should consider each other and I can't find a work around. This is how I fixed it, It works for my setup but it currently requires hacking this module.

Sorry, I can't install GIT on this machine right now otherwise I'd post a patch.

Line 52 - i18n.pages.inc (BEFORE)

$options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language") + $params);

Line 52 - i18n.pages.inc (AFTER)

		  //If Group Context Exist (From OG Module)
		  if(og_get_group_context()) {
		  
			$group_node = og_get_group_context();
		  	$options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language&gids[]=$group_node->nid") + $params);
		  
		  } else {
		  
		    $options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language") + $params);
		  
		  }

I hate hacking modules like this, anyone have a better way of doing this?

- Jayson

Comments

webflo’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Active » Closed (won't fix)

I asume you are using Drupal 7. Please use hook_menu_contextual_links_alter for rewriting the contextual links. Perhaps og_context should do it themselves.