Skip to content

Instantly share code, notes, and snippets.

@thoronas
Last active December 12, 2015 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoronas/87633873faef07196bc8 to your computer and use it in GitHub Desktop.
Save thoronas/87633873faef07196bc8 to your computer and use it in GitHub Desktop.
// gravity forms version of email function
function gforms_notify_users_new_post($entry, $form) {
$post = get_post($entry["post_id"]);
$terms = get_the_terms( $post->ID, 'ad-categories' );
$author_email = "forgeandsmith@gmail.com";
$email_subject = "test";
ob_start(); ?>
<html>
<head>
</head>
<body>
<p>
Someone posted something new!.
</p>
<?php
var_dump($post);
echo "<br />";
var_dump($terms);
?>
<p>
Log in and <a href="<?php echo get_permalink($post->ID) ?>">view the post</a>.
</p>
<p>
Regards,<br />
I Waaant It, Inc.
</p>
</body>
</html>
<?php
$message = ob_get_contents();
ob_end_clean();
wp_mail( $author_email, $email_subject, $message );
}
/*
This function is not working properly right now. The users are not being passed to the email function. I believe there is some problem with the user query.
*/
add_action("gform_after_submission", "gforms_notify_users_new_post", 100, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment