Skip to content

Instantly share code, notes, and snippets.

@Coopeh
Created May 16, 2012 23:06
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 Coopeh/2714763 to your computer and use it in GitHub Desktop.
Save Coopeh/2714763 to your computer and use it in GitHub Desktop.
class.email-post-changes.php.diff
33d32
< 'post_ids' => array(),
182,198d180
< $options = $this->get_options();
< $ids = explode(",", $options['post_ids']);
<
< if (in_array($this->right_post->ID, $ids)){
<
< // Send email
< $charset = apply_filters( 'wp_mail_charset', get_option( 'blog_charset' ) );
< $blogname = html_entity_decode( get_option( 'blogname' ), ENT_QUOTES, $charset );
< $title = html_entity_decode( $the_title, ENT_QUOTES, $charset );
<
< add_action( 'phpmailer_init', array( &$this, 'phpmailer_init_once' ) );
<
< wp_mail(
< null, // see hack in ::phpmailer_init_once()
< sprintf( __( '[%s] %s changed: %s' ), $blogname, $post_type, $title ),
< $html_diff
< );
200,202c182,193
< do_action( 'email_post_changes_email_sent' );
<
< } else {
---
> // Send email
> $charset = apply_filters( 'wp_mail_charset', get_option( 'blog_charset' ) );
> $blogname = html_entity_decode( get_option( 'blogname' ), ENT_QUOTES, $charset );
> $title = html_entity_decode( $the_title, ENT_QUOTES, $charset );
>
> add_action( 'phpmailer_init', array( &$this, 'phpmailer_init_once' ) );
>
> wp_mail(
> null, // see hack in ::phpmailer_init_once()
> sprintf( __( '[%s] %s changed: %s' ), $blogname, $post_type, $title ),
> $html_diff
> );
204,206c195
< return;
<
< }
---
> do_action( 'email_post_changes_email_sent' );
267d255
< add_settings_field( self::ADMIN_PAGE . '_post_ids', __( 'Post IDs' ), array( &$this, 'post_ids_setting' ), self::ADMIN_PAGE, self::ADMIN_PAGE );
315,316d302
< $return['post_ids'] = $options['post_ids'];
<
403,411d388
< function post_ids_setting() {
< $options = $this->get_options();
< ?>
< <input type="text" style="width: 40em;" name="email_post_changes[post_ids]" value="<?php echo $options['post_ids']; ?>" />
< <p class="description"><?php _e( 'Comma separated list of Post/Page IDs' ); ?></p>
<
< <?php
< }
<
455a433
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment