function apoc_report_post() { /* Get the needed data */ $userid = get_current_user_id(); $from = bp_core_get_user_displayname($userid); /* Get AJAX data */ $type = $_POST['type']; $postid = $_POST['id']; $number = $_POST['num']; $user = $_POST['user']; $reason = $_POST['reason']; /* Get the post URL */ if ('reply' == $type) { $link = bbp_get_reply_url($postid); } elseif ('comment' == $type) { $link = get_comment_link($postid); } elseif ('message' == $type) { $link = bp_core_get_user_domain($user) . 'messages/view/' . trailingslashit($postid); $user = bp_core_get_user_displayname($user); } /* Set the email headers */ $subject = "Reported Post From {$from}"; $headers = "From: Post Report Bot <*****@*****.**>\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8"; /* Construct the message */ $body = '<h3>' . $from . ' has reported a post violating the Code of Conduct.</h3>'; $body .= '<ul><li>Report URL: <a href="' . $link . '" title="View Post" target="_blank">' . $link . '</a></li>'; $body .= '<li>Post Number: ' . $number . '</li>'; $body .= '<li>User Reported: ' . $user . '</li>'; $body .= '<li>Reason: ' . $reason . '</li></ul>'; /* Send the email */ $emailto = get_moderator_emails(); wp_mail($emailto, $subject, $body, $headers); echo "1"; exit(0); }
$headers .= "Content-Type: text/html; charset=UTF-8"; // Construct the message $body = '<p>Your user account, ' . $name . ', has been issued a warning for ' . $points . ' point(s) by the moderation team at Tamriel Foundry for the following reason:</p>'; $body .= ' '; $body .= '<p><strong>' . $reason . '</strong></p>'; $body .= ' '; $body .= '<p>Please review the Tamriel Foundry <a href="http://tamrielfoundry.com/topic/tamriel-foundry-code-of-conduct/" title="Read the Code of Conduct" target="_blank">Code of Conduct</a> to better understand the expectations we have of our users.'; $body .= 'You may review your current infractions on your user profile using the following link:</p>'; $body .= '<p><a href="' . $action_url . '" title="View Your Infractions" target="_blank">' . $action_url . '</a>'; // Send the message if ($_POST['email-user']) { $emailto = bp_get_displayed_user_email(); wp_mail($emailto, $subject, $body, $headers); } if ($_POST['email-mods']) { $emailto = get_moderator_emails(); wp_mail($emailto, $subject, $body, $headers); } } // Redirect wp_redirect($action_url, 302); } } ?> <?php get_header(); ?> <div id="content" role="main">