You are here

function protected_node_action_protect_nodes_with_password in Protected Node 7

Same name and namespace in other branches
  1. 6 protected_node.settings.inc \protected_node_action_protect_nodes_with_password()
  2. 1.0.x protected_node.settings.inc \protected_node_action_protect_nodes_with_password()

Make sure all nodes with a password are protected.

It is possible to unprotect a node and still have a password on it. This function restores those nodes protection (i.e. sets the is_protected to 1).

1 string reference to 'protected_node_action_protect_nodes_with_password'
protected_node_admin_settings in ./protected_node.settings.inc
Define the settings form.

File

./protected_node.settings.inc, line 944
Configuration file for the protected_node module.

Code

function protected_node_action_protect_nodes_with_password($form, &$form_state) {
  db_update('protected_nodes')
    ->fields(array(
    'protected_node_is_protected' => 1,
  ))
    ->condition('protected_node_is_protected', 0)
    ->condition('protected_node_passwd', '', '<>')
    ->execute();
  drupal_set_message(t('All nodes with an existing password (excluding the global password) are now protected.'));
}