You are here

function protected_node_action_reset_passwords in Protected Node 6

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

"Reset" all the passwords.

This function assigns the specified password to all the existing protected nodes.

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

File

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

Code

function protected_node_action_reset_passwords($form, &$form_state) {
  $passwd = $form_state['values']['protected_node_reset_passwords_password'];
  if ($passwd) {
    $sql = "UPDATE {protected_nodes} SET protected_node_passwd = '%s'";
    db_query($sql, sha1($passwd));
    variable_set('protected_node_session_timelimit', time());
    drupal_set_message(t('All protected nodes are now publicly visible unless protected by another module.'));
  }
  else {
    form_error($form['protected_node_actions']['protected_node_reset_passwords']['protected_node_reset_passwords_password'], t('Enter a new password to reset all the protected node passwords.'));
  }
}