PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Notification After Post Approval

  1. JMega
    Member

    I'd like to achieve the functionality described in this thread: http://www.gravityhelp.com/forums/topic/solution-automatic-email-once-post-has-been-approved

    However when I add the code outlined in the post above it gives my entire wordpress install a blank white screen.

    Has anyone else experienced this issue or have any ideas on how I can get this to work?

    I am using the latest version of WP and GravityForms.

    Thanks.

    Posted 12 years ago on Monday December 19, 2011 | Permalink
  2. This isn't built in functionality so the only way to do this is to use the customization outlined in that post. If you get a blank white screen when you implement the code the user supplied in that post then the issue is going to be likely due to one of two things.

    Either 1) Your site is running out of available PHP memory and this is causing an error which typically results in the "white screen of death" in WordPress. To increase your PHP memory you can follow the instructions in this tutorial:

    http://www.nerdgrind.com/increase-wordpress-and-php-memory-limit/

    OR 2) The likely issue is the code wasn't implemented in your themes functions.php properly. If you didn't implement the code properly, such as opening or closing PHP where it shouldn't be opened or closed this will cause a PHP error. I would suggest reviewing your code and make sure it is implemented properly.

    Posted 12 years ago on Monday December 19, 2011 | Permalink
  3. JMega
    Member

    Hmmm all that I did was add this code to the bottom of my functions.php:

    function email_members($post_ID)  {
    	global $post;
    	$email_to = get_post_meta($post->ID, 'Member_Email', true);
    	$headers = 'From: Name <name@name.com>' . \\"\r\n\\";
            $subject = "Your subject here";
    	$message = "Your message here";
        wp_mail($email_to, $subject, $message, $headers);
        return $post_ID;
    }
    
    add_action('publish_post', 'email_members');

    Sorry, I'm not very good with PHP... Does anything look off about that code to anyone? I just copied it from the original post and changed the value of my custom field.

    Posted 12 years ago on Monday December 19, 2011 | Permalink
  4. It's hard to tell without seeing it in the context of the entire functions.php file. Use http://pastie.org to provide us with the entire functions.php file with this code in place and we can take a look and see if we see anything unusual.

    Posted 12 years ago on Monday December 19, 2011 | Permalink
  5. JMega
    Member

    Hi Carl... Here is a link to my functions.php: http://pastie.org/3043678

    Thanks so much for your help!

    Posted 12 years ago on Tuesday December 20, 2011 | Permalink
  6. Line 384 does not look correct and is giving me these warnings:

    [php]
    <br />
    <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/homepages/46/d93980635/htdocs/download.php</b> on line <b>384</b><br />
    <br />
    <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/homepages/46/d93980635/htdocs/download.php</b> on line <b>384</b><br />
    No syntax errors detected in download.php

    They're not errors but could be stopping script execution on your site.

    What is the purpose of the unescaped back slashes there?

    Posted 12 years ago on Tuesday December 20, 2011 | Permalink
  7. JMega
    Member

    That was it! Thank you, I would have never spotted that. Might want to update the original post at http://www.gravityhelp.com/forums/topic/solution-automatic-email-once-post-has-been-approved and remove those extra back slashes.

    Thanks again, its working perfectly now :)

    Posted 12 years ago on Tuesday December 20, 2011 | Permalink
  8. Very good. Thank you for the update.

    Posted 12 years ago on Wednesday December 21, 2011 | Permalink

This topic has been resolved and has been closed to new replies.