Ejemplo n.º 1
0
 /**
  * Provides action hooks on reports status transitions
  *
  * @uses do_action() Calls 'appthemes_report_{$new_status}' (approve, hold)
  *
  * @param string $new_status
  * @param string $old_status
  * @param object $comment
  *
  * @return void
  */
 public static function comment_status_transition($new_status, $old_status, $comment)
 {
     if (self::$comment_type != $comment->comment_type) {
         return;
     }
     // no change in or out
     if ($new_status != 'approved' && $old_status != 'approved') {
         return;
     }
     $report = appthemes_get_report($comment->comment_ID);
     do_action('appthemes_report_' . $new_status, $report);
 }
Ejemplo n.º 2
0
 /**
  * Modify the new comment author email text
  *
  * @uses apply_filters() Calls 'appthemes_report_notification_text'
  *
  * @param string $notify_message
  * @param int $comment_id
  *
  * @return string
  */
 public static function notify_email_text($notify_message, $comment_id)
 {
     $comment = get_comment($comment_id);
     if (!$comment || $comment->comment_type != self::$comment_type) {
         return $notify_message;
     }
     $post = get_post($comment->comment_post_ID);
     if (!$post) {
         return $notify_message;
     }
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $report = appthemes_get_report($comment->comment_ID);
     $author = get_comment_author($comment->comment_ID);
     $notify_message = html('p', __('Dear Admin,', APP_TD)) . PHP_EOL;
     $notify_message .= html('p', sprintf(__('A new report has been submitted on "%1$s" by %2$s.', APP_TD), $post->post_title, $author)) . PHP_EOL;
     $notify_message .= html('p', sprintf(__('Reported as: %s', APP_TD), $comment->comment_content)) . PHP_EOL;
     $notify_message .= html('p', sprintf(__('Edit post: %s', APP_TD), appthemes_get_edit_post_url($post->ID, ''))) . PHP_EOL;
     if (EMPTY_TRASH_DAYS) {
         $notify_message .= html('p', sprintf(__('Trash it: %s', APP_TD), admin_url("comment.php?action=trash&c={$comment_id}"))) . PHP_EOL;
     } else {
         $notify_message .= html('p', sprintf(__('Delete it: %s', APP_TD), admin_url("comment.php?action=delete&c={$comment_id}"))) . PHP_EOL;
     }
     $notify_message .= html('p', __('You will not receive further notification for this post until report has been deleted. However all future reports will be logged and can be viewed on each edit post page.', APP_TD)) . PHP_EOL;
     $notify_message .= html('p', __('Regards,', APP_TD) . '<br />' . sprintf(__('Your %s Team', APP_TD), $blogname)) . PHP_EOL;
     return apply_filters('appthemes_report_notification_text', $notify_message, $comment_id);
 }
Ejemplo n.º 3
0
/**
 * Activates a report by setting the status to 'approve' (comment status)
 *
 * @param int $report_id The report ID
 *
 * @return void
 */
function appthemes_activate_report($report_id)
{
    $report = appthemes_get_report($report_id);
    $report->approve();
}