Email::ap_trash_answer( integer $post_id, object $_post )

Description #

Notify admin on trashing a answer.

Parameters #

  • $post_id
    integer (Required) Post ID.
  • $_post
    object (Required) Post object.

Source #

File: addons/email/email.php

	public function ap_trash_answer( $post_id, $_post ) {
		if ( ! ap_opt( 'email_admin_trash_answer' ) ) {
			return;
		}

		$args         = array();
		$current_user = wp_get_current_user();
		$admin_emails = $this->get_admin_emails( 'email_admin_trash_question' );

		if ( ! empty( $admin_emails ) ) {
			$args['users'] = $admin_emails;
		}

		$args['tags'] = array(
			'{user}'           => ap_user_display_name( get_current_user_id() ),
			'{question_title}' => $_post->post_title,
			'{question_link}'  => wp_get_shortlink( $_post->post_parent ),
		);

		$email = new EmailHelper( 'trash_question', $args );
		$email->send_emails();
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment