3

Here is a screenprint to illustrate part of my current implementation:

enter image description here

This is what I want to achieve:

  • If the value of 'Admin Status' is not "Approved", then the author can still edit or delete his/her own content.

  • If the value of 'Admin Status' is "Approved", then the content can not be edited by the author.

I have tried a lot, even using the Rules module, but nothing works for me.

Any suggestions about how to get this to work?

0

2 Answers 2

2

You can get this to work with the Rules module by using Event System > Drupal is initializing, combined with a Rules Condition related to the URL for the edit or delete operation.

Disallow edit

The rule you'd need for disallowing 'edit', is a variation of the rule I included (in export format) in my answer to the question about How to restrict access to a node via node/12 and allow access via a path like content/sometitle?

These are the changes to that rule to make it work this case also:

  • The paths containing node should be extended by adding /edit at the end (I'm assuming that's how the URL for your edit link looks like).
  • Add a (1st) Rules 'Condition' like "If Author id matches the uid".
  • Add a (2nd) Rules 'Condition' like "If Admin Status is Approved".
  • Change the "Message" (in the Rules 'Action' to something to indicate that the edit is not allowed because Admin Status is Approved.
  • Modify the Rules 'Action' to fit your own requirements, e.g. to issue a redirect to some 'help page' with more details about this.

Disallow delete

Should you also want to disallow 'delete' by the author for "Admin status" = 'Approved' (which is not what your question currently says however ...), then create another rule in which you use a similar approach as for 'edit' (as described above), just replace all 'edit' by 'delete'.

Combine both rules

It should be possible to consolidate the 2 suggested rules above, using "OR" within Rules. Know however that this is a very little harder to get it to work. So learn to walk (= get it to work with 2 separated rules) before you want to learn to fly ...

Video tutorials

If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework, organized in 7 chapters.

Note: your question does not say what should happen (what is allowed or not) when a user who is not the author tries to edit or delete something with 'Admin Status' = Approved. If such scenario is possible in your setup, then you might have to further enhance the Rules Condition I suggested accordingly ...

0
0

The first thing that comes to my mind is changing the content type of the node. A module that you could use to change content types at least manually would be Node Convert. However I don't know if this can also be triggered by the Rules or Flag modules, or the like.

Anyways – changing the content type of a node would enable you to give permissions accordingly:

  1. content-type-not-approved –> author can still edit

  2. content-type-approved –> author can not edit any more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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