1

I am running a D7 multi-language site. I am looking for a solution to restrict node AND block editing for english language, only. The editor should not be allowed to edit french content. How can accomplish what I'm looking for?

So far, I have created a new user (e.g. english editor) and added them to a new role. I am also using contrib module 'Content Access' and 'block access'. However I have to restrict access per node which is not my perfect choice. With block_access module, english editors are still able to see/modify translations

  • 1
    I had a similar problem, I had to lock English nodes so translators don't change them by accident. You can set up a Rule for it, check this answer: drupal.stackexchange.com/questions/180953/… – prkos Jun 7 '18 at 20:39
  • prkos, thanks for sharing. This sounds like a promising solution to my question. I am not sure on how to restrict editing block, though. How do I restrict translatable blocks? – howdytom Jun 9 '18 at 10:25
  • 1
    You might be able to conjure something up with Rules Bonus Pack or Rules block visibility depending how your translators access blocks to translate. – prkos Jun 9 '18 at 14:46
0

For your solution you can implement hook_node_access, as you see this function takes 3 arguments $node which is the content the user wants to make an operation on it, there you can check content's language, $op is the operation which user wants to make on the content which in your case you can check if it is edition, and finally $account takes the information about the user so you can decide if user is allowed to do the operation or not.

One big consideration is that this hook is not fired for the super user (user with uid = 1) as he bypasses almost all permissions, so in this case you can use hook_init and make a redirect based on node arguments.

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.