Email::ap_after_update_question( int $post_id, object $question )
Description #
Notify after question get updated.
Parameters #
- $post_idint (Required) Question id.
- $questionobject (Required) Question object.
Source #
File: addons/email/email.php
public function ap_after_update_question( $post_id, $question ) { if ( in_array( $question->post_status, array( 'trash', 'draft' ), true ) ) { return; } $args = array(); $admin_emails = $this->get_admin_emails( 'email_admin_edit_question' ); if ( ! empty( $admin_emails ) ) { $args['users'] = $admin_emails; } $current_user = wp_get_current_user(); $email = new EmailHelper( 'edit_question', $args ); $subscribers = ap_get_subscribers( array( 'subs_event' => 'question', 'subs_ref_id' => $question->ID, ) ); // Exclude current author. if ( get_current_user_id() !== (int) $question->post_author ) { $email->add_user( $question->post_author ); } foreach ( (array) $subscribers as $s ) { if ( ap_user_can_view_post( $question ) && ! empty( $s->user_email ) && $s->user_email !== $current_user->user_email ) { $email->add_email( $s->user_email ); } } $email->add_template_tags( array( 'asker' => ap_user_display_name( $question->post_author ), 'editor' => ap_user_display_name( get_current_user_id() ), 'question_title' => $question->post_title, 'question_link' => get_permalink( $question->ID ), 'question_content' => $question->post_content, 'question_excerpt' => ap_truncate_chars( wp_strip_all_tags( $question->post_content ), 100 ), ) ); $email->send_emails(); }
Expand full source code Collapse full source code View on GitHub: addons/email/email.php:490
Add your comment