You are here

function password_policy_save_policy in Password Policy 5

Same name and namespace in other branches
  1. 7 password_policy.module \password_policy_save_policy()

Saves the policy instance in the database as a new policy.

Parameters

$policy: The policy object instance (of type And_Constraint) to save.

1 call to password_policy_save_policy()
password_policy_form_policy_form_submit in ./password_policy.module
Form submission hook for new or edited password policies.

File

./password_policy.module, line 626

Code

function password_policy_save_policy($policy) {
  $cid = db_next_id('{password_policy}_id');
  db_query("INSERT INTO {password_policy} SET id = %d, name = '%s', description = '%s', enabled = %d, serialized_policy = '%s'", $cid, $policy->name, $policy->description, 0, serialize($policy));
  drupal_set_message(t('Policy \'%name\' has been updated.', array(
    '%name' => $policy->name,
  )));
}