Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Last active March 28, 2022 08:55
Show Gist options
  • Save patrickposner/5e1de2c74896b935cf83587ec2bbfa24 to your computer and use it in GitHub Desktop.
Save patrickposner/5e1de2c74896b935cf83587ec2bbfa24 to your computer and use it in GitHub Desktop.
Passster: Send e-mail once password was used.
<?php
add_action( 'passster_validation_success_list', function( $password, $password_list_id, $post_id ) {
// prepare and send the e-mail.
$to = '[email protected]';
$subject = 'Password ' . $password . 'was used';
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
$body = 'Password ' . $password . ' form passwords list ' . get_the_title( $password_list_id ) . ' was used to unlock content on ' . get_permalink( $post_id );
// Now we can send the e-mail.
wp_mail( $to, $subject, $body, $headers );
}, 2, 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment