public function inform_about_posts( $post_id = FALSE ) {

		if ( ! $post_id ) {
			return $post_id;
		}

		if ( ! isset( $this->transit_posts[ $post_id ] ) ) {
			return $post_id;
		}

		$transit = $this->transit_posts[ $post_id ];
		if ( 'publish' != $transit[ 'new_status' ] || 'publish' == $transit[ 'old_status' ] ) {
			return $post_id;
		}

		// get data from current post
		$post_data = get_post( $post_id );
		// get mail from author
		$user = get_userdata( $post_data->post_author );

		// email addresses
		$to = $this->get_members( $user->data->user_email, 'post' );
		if ( empty( $to ) ) {
			return $post_id;
		}

		// email subject
		$subject = get_option( 'blogname' ) . ': ' . get_the_title( $post_data->ID );
		// message content
		$message = $post_data->post_content;
		# create header data
		$headers = array();
		# From:
		$headers[ 'From' ] =
			get_the_author_meta( 'display_name', $user->ID ) .
			' (' . get_bloginfo( 'name' ) . ')' .
			' <' . $user->data->user_email . '>';

		if ( $this->options[ 'send_by_bcc' ] ) {
			$bcc              = $to;
			$to               = empty( $this->options[ 'bcc_to_recipient' ] )
				? get_bloginfo( 'admin_email' )
				: $this->options[ 'bcc_to_recipient' ];
			$headers[ 'Bcc' ] = $bcc;
		}

		$to          = apply_filters( 'iac_post_to', $to, $this->options, $post_id );
		$subject     = apply_filters( 'iac_post_subject', $subject, $this->options, $post_id );
		$message     = apply_filters( 'iac_post_message', $message, $this->options, $post_id );
		$headers     = apply_filters( 'iac_post_headers', $headers, $this->options, $post_id );
		$attachments = apply_filters( 'iac_post_attachments', array(), $this->options, $post_id );
		$signature   = apply_filters( 'iac_post_signature', '', $this->options, $post_id );

		$this->options[ 'static_options' ][ 'object' ] = array( 'id' => $post_id, 'type' => 'post' );

		$this->send_mail(
			$to,
			$subject,
			$this->append_signature( $message, $signature ),
			$headers,
			$attachments
		);

		return $post_id;
	}
public function inform_about_posts( $post_id = FALSE ) {

		if ( ! $post_id ) {
			return $post_id;
		}

		if ( ! isset( $this->transit_posts[ $post_id ] ) ) {
			return $post_id;
		}

		$transit = $this->transit_posts[ $post_id ];
		if ( 'publish' != $transit[ 'new_status' ] || 'publish' == $transit[ 'old_status' ] ) {
			return $post_id;
		}

		// get data from current post
		$post_data = get_post( $post_id );
		// get mail from author
		$user = get_userdata( $post_data->post_author );

		// email addresses
		$to = $this->get_members( $user->data->user_email, 'post' );
		if ( empty( $to ) ) {
			return $post_id;
		}

		// email subject
		$subject = get_option( 'blogname' ) . ': ' . get_the_title( $post_data->ID );
		// message content
		$message = $post_data->post_content;
		# create header data
		$headers = array();
		# From:
		$headers[ 'From' ] =
			get_the_author_meta( 'display_name', $user->ID ) .
			' (' . get_bloginfo( 'name' ) . ')' .
			' <' . $user->data->user_email . '>';

		if ( $this->options[ 'send_by_bcc' ] ) {
			$bcc              = $to;
			$to               = empty( $this->options[ 'bcc_to_recipient' ] )
				? get_bloginfo( 'admin_email' )
				: $this->options[ 'bcc_to_recipient' ];
			$headers[ 'Bcc' ] = $bcc;
		}

		$to          = apply_filters( 'iac_post_to', $to, $this->options, $post_id );
		$subject     = apply_filters( 'iac_post_subject', $subject, $this->options, $post_id );
		$message     = apply_filters( 'iac_post_message', $message, $this->options, $post_id );
		$headers     = apply_filters( 'iac_post_headers', $headers, $this->options, $post_id );
		$attachments = apply_filters( 'iac_post_attachments', array(), $this->options, $post_id );
		$signature   = apply_filters( 'iac_post_signature', '', $this->options, $post_id );

		$this->options[ 'static_options' ][ 'object' ] = array( 'id' => $post_id, 'type' => 'post' );

		$this->send_mail(
			$to,
			$subject,
			$this->append_signature( $message, $signature ),
			$headers,
			$attachments
		);

		return $post_id;
	}
public function inform_about_posts ( $ post_id = FALSE ) { if ( ! $ post_id ) { return $ post_id ; } if ( ! isset ( $ this -> transit_posts [ $ post_id ] ) ) { return $ post_id ; } $ transit = $ this -> transit_posts [ $ post_id ] ; if ( 'publish' != $ transit [ 'new_status' ] || 'publish' == $ transit [ 'old_status' ] ) { return $ post_id ; } // get data from current post $ post_data = get_post ( $ post_id ) ; // get mail from author $ user = get_userdata ( $ post_data -> post_author ) ; // email addresses $ to = $ this -> get_members ( $ user -> data -> user_email , 'post' ) ; if ( empty ( $ to ) ) { return $ post_id ; } // email subject $ subject = get_option ( 'blogname' ) . ': ' . get_the_title ( $ post_data -> ID ) ; // message content $ message = $ post_data -> post_content ; # create header data $ headers = array ( ) ; # From: $ headers [ 'From' ] = get_the_author_meta ( 'display_name' , $ user -> ID ) . ' (' . get_bloginfo ( 'name' ) . ')' . ' <' . $ user -> data -> user_email . '>' ; if ( $ this -> options [ 'send_by_bcc' ] ) { $ bcc = $ to ; $ to = empty ( $ this -> options [ 'bcc_to_recipient' ] ) ? get_bloginfo ( 'admin_email' ) : $ this -> options [ 'bcc_to_recipient' ] ; $ headers [ 'Bcc' ] = $ bcc ; } $ to = apply_filters ( 'iac_post_to' , $ to , $ this -> options , $ post_id ) ; $ subject = apply_filters ( 'iac_post_subject' , $ subject , $ this -> options , $ post_id ) ; $ message = apply_filters ( 'iac_post_message' , $ message , $ this -> options , $ post_id ) ; $ headers = apply_filters ( 'iac_post_headers' , $ headers , $ this -> options , $ post_id ) ; $ attachments = apply_filters ( 'iac_post_attachments' , array ( ) , $ this -> options , $ post_id ) ; $ signature = apply_filters ( 'iac_post_signature' , '' , $ this -> options , $ post_id ) ; $ this -> options [ 'static_options' ] [ 'object' ] = array ( 'id' => $ post_id , 'type' => 'post' ) ; $ this -> send_mail ( $ to , $ subject , $ this -> append_signature ( $ message , $ signature ) , $ headers , $ attachments ) ; return $ post_id ; }
Send mail, if changes a status form not 'publish' to 'publish'

@wp_hook publish_post
@since   0.0.1
@uses    get_post, get_userdata, get_author_name, get_option, wp_mail, get_permalink

@param   string|bool $post_id

@return  string $post_id
Send mail if changes a status form not publish to publish