You are here

function protected_node_rules_action_password_protect in Protected Node 7

Same name and namespace in other branches
  1. 6 protected_node_rules.rules.inc \protected_node_rules_action_password_protect()
  2. 1.0.x protected_node_rules/protected_node_rules.rules.inc \protected_node_rules_action_password_protect()

Activate the password protection on the specified node.

2 string references to 'protected_node_rules_action_password_protect'
ProtectedNodeRules::testPasswordProtect in protected_node_rules/tests/protected_node_rules.test
Test function.
ProtectedNodeRules::testPasswordProtectNoValueGiven in protected_node_rules/tests/protected_node_rules.test
Test function.

File

protected_node_rules/protected_node_rules.rules.inc, line 116
Rules integration for the protected_node module.

Code

function protected_node_rules_action_password_protect($node, $passwd, $show_title) {
  $node->protected_node_is_protected = 1;
  $node->protected_node_show_title = $show_title;

  // Note: the following test prevents the user from using "0" as a password.
  $node->protected_node_passwd = $passwd ? $passwd : user_password();
  return array(
    'node' => $node,
  );
}