Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The simple, but not-so-clean way, is the route you already took, but with an additional, small module to help it.</p> <ul> <li>has a function <code>my_module_can_delete($user)</code>, that returns <code>TRUE</code> if the user is allowed to delete, <code>FALSE</code> if the user is not. </li> <li>implements <code>hook_form_alter()</code> to modify and delete the button on the node_edit form, if <code>my_module_can_delete($user)</code></li> <li>implements <code>hook_form_alter()</code> to modify the confirm form that is called on /node/%nid/delete, and add a message there, telling the user he or she <code>my_module_can_delete($user)</code>. This should be enough, since disabling this form will result in users not being able to get past this form. FORM-API will take care of that.</li> </ul> <p>However, you can make it more sturdy, to catch other deleting modules:</p> <ul> <li>implements <code>hook_nodeapi()</code>, <code>$op == 'delete'</code> to catch delete actions and halt (by invoking <code>drupal_goto()</code>, or calling <code>drupal_access_denied()</code> to enforce a user-error. Only catch delete-actions if the referer was the delete-confirm-form as mentioned above. Or, more secure, whitelist your VBO-action and return false on all other referers. A referer can often be found by reading out the $node passed along to <code>hook_nodeapi()</code>.</li> </ul> <p>A, IMHO, much cleaner, but probably more intensive <strong>alternative</strong>, would be to simply make sure your batches/actions are called on every delete action. </p> <p>In a module, you could do this by avoiding all the VBO-configuration and leaving all the extra-delete actions out of there. Then write a module that implements <code>hook_nodeapi()</code> and then calls all the cleaning actions from there. That way you can be sure that your delete-actions are called on every delete-action on any node. Obviously you can add some conditions into your hook_nodeapi() to only invoke your modules in certain cases (node-types, user-roles, permissions and so on).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload