Email::new_comment( object $comment )
Description #
Notify admin on new comment and is not approved.
Parameters #
- $commentobject (Required) Comment object.
Source #
File: addons/email/email.php
public function new_comment( $comment ) { $args = array(); $admin_emails = $this->get_admin_emails( 'email_admin_new_comment' ); if ( ! empty( $admin_emails ) ) { $args['users'] = $admin_emails; } if ( ap_opt( 'email_user_new_comment' ) ) { $current_user = wp_get_current_user(); $post = ap_get_post( $comment->comment_post_ID ); $subscribers = ap_get_subscribers( array( 'subs_event' => 'comment_' . $comment->comment_post_ID ) ); if ( get_current_user_id() !== $post->post_author ) { $args['users'][] = $post->post_author; } foreach ( (array) $subscribers as $s ) { if ( ap_user_can_view_post( $post ) && $s->user_email !== $current_user->user_email ) { $args['users'][] = $s->user_email; } } } // Check if have emails before proceeding. if ( empty( $args['users'] ) ) { return; } $args['tags'] = array( '{commenter}' => ap_user_display_name( $comment->user_id ), '{question_title}' => $post->post_title, '{comment_link}' => get_comment_link( $comment ), '{comment_content}' => $comment->comment_content, ); $email = new EmailHelper( 'new_comment', $args ); $email->send_emails(); }
Expand full source code Collapse full source code View on GitHub: addons/email/email.php:441
Add your comment