Content translation provides a "Translate" tab on node/%nid pages.
This tab is only accessible under these circomstances (see the access callback for node/%nid/translate) :

  • the node has a language
  • the node's type supports translation
  • user can view the node (using node_access('view', $node))
  • user has access 'translate content'

The problem is that in some cases, user can view the node (thanks to Module Grants), but node_access('view', $node) returns FALSE.
This causes the translate tab not to show in some cases it should.

I think module_grants_menu_alter should handle node/%nid/translate path's access callback, am I right ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David Stosik’s picture

Assigned: Unassigned » David Stosik
Status: Active » Needs review
FileSize
1.16 KB

Here is my suggestion.

RdeBoer’s picture

Thanks David. Your patch makes sense. Hope to apply and test soon -- Rik

RdeBoer’s picture

Status: Needs review » Fixed

Patch checked into repository (HEAD). Will be available in 6.x-3.6.

sdelbosc’s picture

Just to track the issue...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

blaiz’s picture

Status: Closed (fixed) » Active

Hi,

Thanks for this patch, it works well but there's still a problem. Before the patch, for me, if you don't have the 'administer node' permission, then you cannot translate a node that is unpublished, which is not convenient because we are migrating an static website to Drupal and we would like to have all the content ready and not wait to publish it to begin translating.

This patch made the translate tab appear and the node is translatable now but the problem is that it doesn't get the current text on the current node, to be translated (pre-populating the text-fields), and the language for this translation is wrong, it is still set to English, instead of Italien or French.

I configured my content type so the languages is locked, cannot be changed for a node, because all or our nodes are created in English first and when we want to translate, we use the translate tab for this. The bug is that with this patch, when I click on Translate, next to the language I want, the new text-fields are not pre-populated and the language is set to English and is locked. If I save, the node is treated as a new, English, node, and not as a translation of the one I wanted to translate.

Do you think there could be a solution for that too?

Thanks,

Blaiz

blaiz’s picture

I have to bump this issue, it is still important to me. For now, my translators are given the "administer node" permission because otherwise they can't translate a node that is still unpublished, which doesn't make sense I think.

RdeBoer’s picture

Assigned: David Stosik » Unassigned

Sorry for leaving this issue so long. I may need some help from someone more familiar with Drupal I18n... Any takers?

RdeBoer’s picture

Status: Active » Closed (won't fix)

No reaction. Closing.

drupaltrain’s picture

Status: Closed (fixed) » Closed (won't fix)

I had an issue seeing the translate tab appear on unpublished content that I wasn't the owner of...using Drupal 6...

So, due to the fact that "node_access" check function will only display the "translate" tab for unpublished content *only if* the user owns the node, I mimicked the node owner to be the me as I was working on it...

I did this inside "hook_nodeapi", where, after checking I was working with the correct content type (and checking for a specific role - not needed, but I needed it in my case), I set the node uid to the user uid (user uid being my account uid).

Snippet:

if ($node->type == MY_NODE_TYPE_VALUE) {
   if (in_array(MY_ROLE, array_values($user->roles))) {
    if ($user->uid != $node->uid) {
      $node->uid = $user->uid;
    }
  }  
}

This way the information acts as a workaround to display the "translate"
tab while insuring data integrity by not overwriting the node owner uid in the database.

Worked for me anyway...

drupaltrain’s picture

Status: Closed (won't fix) » Closed (fixed)

Oh, forgot to change status...

Status: Closed (won't fix) » Closed (fixed)