15

I'm trying to create a role for editors where one editor only has access to edit English contents and the other only has access to contents in another language.

I've been researching for quite a while, checked out Content Access too, but I haven't found any solution.

How can I make this happen?

Thank you!

2

The answered Specified here would help you give-permission-to-translate-a-specific-language

After installing Translation Management Module,

You can create users with their translation capabilities

You can specify that a user can only translate from English to Spanish and another user can translate from English to French while creating the user

  • Create a new user with user role: Translator (which is created when tmgt module is installed)

  • Then Choose his/her Translation skills as shown below :

enter image description here

  • 1
    In this case, I would need permissions for users to create/edit contents of a specific language, like I described, it's not for translation. – Bálint Deáki Dec 19 '14 at 8:55
1

perhaps you may use the 7.x-dev version of this https://www.drupal.org/project/i18n_access

0

You can replace or change the access callback for node edit forms using hook_menu_alter.

To make a permission that will show up in the permissions screen based on your available languages you would need a custom module with this hook in it:

/**
 * Implements hook_permission().
 */
function MODULENAME_permission(){

  //do something here to get an array of language names: $languages (I'm not familiar with i18n)

  foreach ($languages as $lang) {
    $permissions[$term->name] = array(
      'title' => t($lang->name), //Or wherever the langauge name is stored
      'description' => t('Edit content in '. $lang->name), //Again, adjust as needed
    );
  }

  return $permissions;
}

This will put a tick box in the permissions page under your module name for each language on the site. I'm going to assume language names don't change in which case this is safe to do.

Then you just need to use them to block access if the user is not allowed like this:

/**
 * Implements hook_node_access($node, $op, $account).
 */
function MODULENAME_node_access($node, $op, $account){

  //Get the language name for the node and store in variable $lang (again, I don't know how)

  //Then see if the user can do anything except view it
  if ($op != 'view'){
    if (!user_access($lang)){
      return NODE_ACCESS_DENY;
    }
  }

  return NODE_ACCESS_IGNORE;
}

Note, doing it this way, the role will need the 'edit nodes' permission AND the language based permission to edit any node.

  • That being said, it looks like the i18n_access module will do the trick. – Darvanen Jan 5 '15 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.