<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
#3434 (Akismet catches spam for moderator, but moderators are able to bypass spam)
– bbPress Trac
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--[if IE]><script type="text/javascript">
if (/^#__msie303:/.test(window.location.hash))
window.location.replace(window.location.hash.replace(/^#__msie303:/, '#'));
</script><![endif]-->
<link rel="search" href="/search" />
<link rel="prev" href="/ticket/3433" title="Ticket #3433" />
<link rel="last" href="/ticket/3614" title="Ticket #3614" />
<link rel="help" href="/wiki/TracGuide" />
<link rel="alternate" href="/ticket/3434?format=csv" type="text/csv" class="csv" title="Comma-delimited Text" />
<link rel="alternate" href="/ticket/3434?format=tab" type="text/tab-separated-values" class="tab" title="Tab-delimited Text" />
<link rel="alternate" href="/ticket/3434?format=rss" type="application/rss+xml" class="rss" title="RSS Feed" />
<link rel="next" href="/ticket/3435" title="Ticket #3435" />
<link rel="start" href="/wiki" />
<link rel="stylesheet" href="https://s.w.org/style/trac/common/css/trac.css?v=220" />
<link rel="stylesheet" href="https://s.w.org/style/trac/common/css/ticket.css?v=220" />
<link rel="stylesheet" href="https://s.w.org/style/trac/common/css/jquery-ui/jquery-ui.css?v=220" />
<link rel="stylesheet" href="https://s.w.org/style/trac/common/css/jquery-ui-addons.css?v=220" />
<link rel="icon" href="https://bbpress.org/favicon.ico" type="image/x-icon" />
<link rel="first" href="/ticket/1" title="Ticket #1" />
<style id="trac-noscript" type="text/css">.trac-noscript { display: none !important }</style>
<link type="application/opensearchdescription+xml" rel="search" href="/search/opensearch" title="Search bbPress Trac" />
<script type="text/javascript">
var auto_preview_timeout=2.0;
var form_token="52541ea97824fe9085442ebe";
var jquery_ui={"ampm":true,"date_format":"mm/dd/yy","day_names":{"abbreviated":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"narrow":["Su","Mo","Tu","We","Th","Fr","Sa"],"wide":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},"default_timezone":null,"first_week_day":0,"month_names":{"abbreviated":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wide":["January","February","March","April","May","June","July","August","September","October","November","December"]},"period_names":{"am":["AM","AM"],"pm":["PM","PM"]},"show_timezone":false,"time_format":"hh:mm:ss TT","timepicker_separator":" ","timezone_iso8601":false,"timezone_list":null};
var comments_prefs={"comments_order":"oldest","show_comments":"true","show_prop_changes":"true"};
</script>
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
<link rel="dns-prefetch" href="//www.googletagmanager.com" />
<script>//<![CDATA[
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P24PF4B');
//]]></script>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.8.1-alpha" type="text/css" media="all" />
<link type="text/css" media="screen" rel="stylesheet" href="//bbpress.org/wp-content/themes/bb-base/style.css?v=24" />
<link type="text/css" media="screen" rel="stylesheet" href="//bbpress.org/wp-content/themes/bb-base/style-bbpress.css?v=24" />
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="https://s.w.org/wp-includes/css/dashicons.min.css?20150710" type="text/css" />
<link rel="stylesheet" type="text/css" href="https://s.w.org/style/trac/wp-trac.css?220" />
<script src="https://s.w.org/style/trac/common/js/jquery.js?v=220"></script>
<link rel="canonical" href="https://bbpress.trac.wordpress.org/ticket/3434" />
<script src="https://s.w.org/style/trac/common/js/babel.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/trac.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/search.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/folding.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/wikitoolbar.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/resizer.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/auto_preview.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/jquery-ui.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/jquery-ui-addons.js?v=220"></script>
<script src="https://s.w.org/style/trac/common/js/jquery-ui-i18n.js?v=220"></script>
<script type="text/javascript">
jQuery("#trac-noscript").remove();
jQuery(document).ready(function($) {
$(".trac-autofocus").focus();
$(".trac-target-new").attr("target", "_blank");
if ($.ui) { /* is jquery-ui added? */
$(".trac-datepicker:not([readonly])").prop("autocomplete", "off").datepicker();
$(".trac-datetimepicker:not([readonly])").prop("autocomplete", "off").datetimepicker();
$("#main").addClass("trac-nodatetimehint");
}
$(".trac-disable").disableSubmit(".trac-disable-determinant");
setTimeout(function() { $(".trac-scroll").scrollToTop() }, 1);
$(".trac-disable-on-submit").disableOnSubmit();
});
</script>
<script src="https://s.w.org/style/trac/common/js/threaded_comments.js?v=220"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("div.description").find("h1,h2,h3,h4,h5,h6").addAnchor(_("Link to this section"));
$(".foldable").enableFolding(false, true);
/*<![CDATA[*/
$("#attachments").toggleClass("collapsed");
$("#trac-up-attachments").click(function () {
$("#attachments").removeClass("collapsed");
return true;
});
$("#modify").parent().toggleClass("collapsed");
$(".trac-topnav a").click(function() { $("#modify").parent().removeClass("collapsed"); });
function setRevertHandler() {
$("button.trac-revert").click(function() {
var div = $("div", this);
var field_name = div[0].id.substr(7);
var field_value = div.text();
var input = $("#propertyform *[name=field_" + field_name + "]");
if (input.length > 0) {
if (input.filter("input[type=radio]").length > 0) {
input.val([field_value]);
} else if (input.filter("input[type=checkbox]").length > 0) {
input.val(field_value == "1" ? [field_value] : []);
} else {
input.val(field_value);
}
} else { // Special case for CC checkbox
input = $("#propertyform input[name=cc_update]").val([]);
}
input.change();
// Remove the revert button
if ($(this).closest("tbody").children("tr").length === 1)
$(this).closest(".trac-change-panel").remove();
else
$(this).closest("tr").remove();
return false;
});
}
setRevertHandler();
var comment_focused = false;
$("#comment").focus(function() { comment_focused = true; })
.blur(function() { comment_focused = false; });
$("#propertyform").autoSubmit({preview: '1'}, function(data, reply) {
var items = $(reply);
// Update ticket box
$("#ticket").replaceWith(items.filter('#ticket'));
// Replaces content of #changelog, without recreating it
$("#changelog").empty().append(items.filter("#changelog").contents());
// Apply comments order and "Show" preferences
applyCommentsOrder(
$('#prefs input[name="trac-comments-order"]:checked').val());
// Show warning
var new_changes = $("#changelog .trac-new");
$("#trac-edit-warning").toggle(new_changes.length != 0);
if (new_changes.length != 0)
$("#changelog").parent().show().removeClass("collapsed");
// Update view time
$("#propertyform input[name='view_time']").replaceWith(items.filter("input[name='view_time']"));
// Update preview
var preview = $("#ticketchange").html(items.filter('#preview').children());
var show_preview = preview.children().length != 0;
$("#ticketchange").toggle(show_preview);
setRevertHandler();
// Execute scripts to load stylesheets
items.filter("script").appendTo("head");
}, "#ticketchange .trac-loading");
$("#trac-comment-editor").autoSubmit({preview_comment: '1'}, function(data, reply) {
var comment = $("#trac-comment-editor").next("div.comment").html(reply);
comment.toggle(comment.children().length != 0);
}, "#changelog .trac-loading");
/*]]>*/
});
</script>
</head>
<body id="wordpress-org" class="bbpress trac wporg-make make-bbpress">
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P24PF4B" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<dl id="accessibility">
<dt>Skip to:</dt>
<dd><a href="#content" title="Skip to content">Content</a></dd>
</dl>
<div id="wporg-header">
<div id="header-inner">
<button id="mobile-menu-button" aria-expanded="false"><span class="screen-reader-text">Toggle Menu</span></button>
<ul id="wporg-header-menu">
<li><a href="https://bbpress.org/about/">About</a></li>
<li><a href="https://bbpress.org/plugins/">Plugins</a></li>
<li><a href="https://bbpress.org/themes/">Themes</a></li>
<li><a href="https://codex.bbpress.org/">Documentation</a></li>
<li><a href="https://bbpress.org/blog/">Blog</a></li>
<li><a href="https://bbpress.org/forums/">Support</a></li>
<li class="download"><a href="https://bbpress.org/download/">Download</a></li>
</ul>
<h1><a href="https://bbpress.org">bbPress.org</a></h1>
</div>
</div>
<div id="subnav">
<div id="subnav-inner">
<ul id="nav-user" class="menu">
<li class="last first">
<a href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fbbpress.trac.wordpress.org%2Fticket%2F3434" class="login">Login</a>
</li>
</ul>
</div>
</div>
<div id="banner">
<form id="search" action="/search" method="get">
<div>
<label for="proj-search">Search:</label>
<input type="text" id="proj-search" name="q" size="18" value="" />
<input type="submit" value="Search" />
</div>
</form>
</div>
<div id="mainnav" class="nav">
<ul>
<li class="first"><a href="/timeline">Timeline</a></li><li class="active"><a href="/report">View Tickets</a></li><li><a href="/roadmap">Roadmap</a></li><li><a href="/browser">Browse Source</a></li><li class="last"><a href="/ticketgraph">Ticket Graph</a></li>
</ul>
</div>
<div id="main">
<div id="ctxtnav" class="nav">
<h2>Context Navigation</h2>
<ul>
<li class="first"><span>← <a class="prev" href="/ticket/3433" title="Ticket #3433">Previous Ticket</a></span></li><li class="last"><span><a class="next" href="/ticket/3435" title="Ticket #3435">Next Ticket</a> →</span></li>
</ul>
<hr />
</div>
<div id="content" class="ticket">
<div id="ticket" class="trac-content ">
<div class="date">
<p>Opened <a class="timeline" href="/timeline?from=2021-07-28T05%3A12%3A16Z&precision=second" title="See timeline at 07/28/2021 05:12:16 AM">3 years ago</a></p>
<p>Last modified <a class="timeline" href="/timeline?from=2024-11-07T01%3A05%3A28Z&precision=second" title="See timeline at 11/07/2024 01:05:28 AM">22 minutes ago</a></p>
</div>
<h2>
<a href="/ticket/3434" class="trac-id">#3434</a>
<span class="trac-status">
<a href="/query?status=new">new</a>
</span>
<span class="trac-type">
<a href="/query?status=!closed&type=enhancement">enhancement</a>
</span>
</h2>
<h1 id="trac-ticket-title" class="searchable">
<span class="summary">Akismet catches spam for moderator, but moderators are able to bypass spam</span>
</h1>
<table class="properties">
<tr>
<th id="h_reporter">Reported by:</th>
<td headers="h_reporter" class="searchable">
<a href="https://profiles.wordpress.org/r-a-y" data-nicename="r-a-y">
<img class="avatar" src="https://wordpress.org/grav-redirect.php?user=r-a-y&s=48" srcset="https://wordpress.org/grav-redirect.php?user=r-a-y&s=96 2x" height="48" width="48" alt="r-a-y's profile" />
</a>
<a class="trac-author" href="/query?status=!closed&reporter=r-a-y">r-a-y</a>
</td>
<th id="h_owner" class="missing">Owned by:</th>
<td headers="h_owner">
</td>
</tr>
<tr>
<th id="h_milestone">
Milestone:
</th>
<td headers="h_milestone">
<a class="milestone" href="/milestone/Awaiting%20Review" title="No date set">Awaiting Review</a>
</td>
<th id="h_priority">
Priority:
</th>
<td headers="h_priority">
<a href="/query?status=!closed&priority=low">low</a>
</td>
</tr><tr>
<th id="h_severity">
Severity:
</th>
<td headers="h_severity">
<a href="/query?status=!closed&severity=minor">minor</a>
</td>
<th id="h_version">
Version:
</th>
<td headers="h_version">
<a href="/query?status=!closed&version=2.0">2.0</a>
</td>
</tr><tr>
<th id="h_component">
Component:
</th>
<td headers="h_component">
<a href="/query?status=!closed&component=Extend+-+Akismet">Extend - Akismet</a>
</td>
<th id="h_keywords">
Keywords:
</th>
<td headers="h_keywords" class="searchable">
<a href="/query?status=!closed&keywords=~2nd-opinion">2nd-opinion</a> <a href="/query?status=!closed&keywords=~has-patch">has-patch</a>
</td>
</tr><tr>
<th id="h_cc">
Cc:
</th>
<td headers="h_cc" class="searchable">
<a href="/query?status=!closed&cc=~SirLouen">SirLouen</a>
</td>
<th class="missing">
</th>
<td>
</td>
</tr>
</table>
<div class="description">
<h3 id="comment:description">
Description
</h3>
<div class="searchable">
<p>
In the Akismet module, moderators are able to bypass Akismet checks:<br />
<a class="ext-link" href="https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L205-L211"><span class="icon"></span>https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L205-L211</a><br />
</p>
<p>
However, if Akismet catches a post written by a moderator as spam, the following is listed in the "Akismet History" metabox with two entries:<br />
</p>
<ul><li>Akismet caught this post as spam.
</li><li>Post status was changed to publish.
</li></ul><p>
See:<br />
<a class="ext-link" href="https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L578-L599"><span class="icon"></span>https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L578-L599</a><br />
</p>
<p>
Perhaps changing the second log entry from "Post status was changed to publish" to "Akismet spam check overruled. Post status was published because user is a moderator" would be more clear and appropriate.<br />
</p>
</div>
</div>
</div>
<div>
<div class="trac-noscript" style="position: relative">
<form id="prefs" method="get" action="/prefs" style="position: absolute; right: 0">
<div id="trac-comments-order">
<input type="radio" id="trac-comments-oldest" name="trac-comments-order" value="oldest" checked="checked" />
<label for="trac-comments-oldest">Oldest first</label>
<input type="radio" id="trac-comments-newest" name="trac-comments-order" value="newest" />
<label for="trac-comments-newest">Newest first</label>
<span id="trac-threaded-toggle" style="display: none">
<input type="radio" id="trac-comments-threaded" name="trac-comments-order" value="threaded" />
<label for="trac-comments-threaded">Threaded</label>
</span>
</div>
<div>
<input id="trac-show-comments-toggle" type="checkbox" checked="checked" />
<label for="trac-show-comments-toggle">Show comments</label>
<input id="trac-show-property-changes-toggle" type="checkbox" />
<label for="trac-show-property-changes-toggle">Show property changes</label>
</div>
</form>
</div>
<h3 class="foldable">Change History <span class="trac-count">(4)</span></h3>
<div id="changelog">
<div class="change" id="trac-change-1-1627449150110450">
<h3 class="change">
<span class="threading">
<span id="comment:1" class="cnum">
<a href="#comment:1">#1</a>
</span>
</span>
<span class="avatar">
<span class="username-line"><a href="https://profiles.wordpress.org/r-a-y" class="profile-link">
<img src="https://wordpress.org/grav-redirect.php?user=r-a-y&s=48" srcset="https://wordpress.org/grav-redirect.php?user=r-a-y&s=96 2x" height="48" width="48" alt="" /> @<span class="username" data-username="r-a-y" data-nicename="r-a-y"><span class="trac-author">r-a-y</span></span></a></span>
<br /><span class="time-ago"><a class="timeline" href="/timeline?from=2021-07-28T05%3A12%3A30Z&precision=second" title="See timeline at 07/28/2021 05:12:30 AM">3 years</a> ago</span>
</span>
<div class="trac-ticket-buttons">
</div>
</h3>
<div class="trac-ticket-buttons"></div>
<ul class="changes">
<li class="trac-field-component">
<strong class="trac-field-component">Component</strong>
changed from <em>General</em> to <em>Extend - Akismet</em>
</li>
</ul>
</div>
<div class="change" id="trac-change-2-1730442082965865">
<h3 class="change">
<span class="threading">
<span id="comment:2" class="cnum">
<a href="#comment:2">#2</a>
</span>
<span>follow-up:</span>
<a href="#comment:3" class="follow-up">↓ 3</a>
</span>
<span class="avatar">
<span class="username-line"><a href="https://profiles.wordpress.org/wpclungz1" class="profile-link">
<img src="https://wordpress.org/grav-redirect.php?user=wpclungz1&s=48" srcset="https://wordpress.org/grav-redirect.php?user=wpclungz1&s=96 2x" height="48" width="48" alt="" /> @<span class="username" data-username="wpclungz1" data-nicename="wpclungz1"><span class="trac-author">wpclungz1</span></span></a></span>
<br /><span class="time-ago"><a class="timeline" href="/timeline?from=2024-11-01T06%3A21%3A22Z&precision=second" title="See timeline at 11/01/2024 06:21:22 AM">6 days</a> ago</span>
</span>
<div class="trac-ticket-buttons">
</div>
</h3>
<div class="trac-ticket-buttons"></div>
<div class="comment searchable">
<p>
In the Akismet module, moderators are able to bypass Akismet checks:<br />
</p>
<a href="https://www.aiaccount.com"></a> <a href="https://www.3ecpa.com.sg"></a> <a href="https://www.3ecpa.com.my "></a> <a href="https://www.aihrms.com "></a> <a href="https://a-nz1.shop"></a> <a href="https://a-nz2.shop"></a> <a href="https://a-nz3.shop"></a> <a href="https://a-nz4.shop"></a> <a href="https://a-nz5.shop"></a> <a href="https://a-nz6.shop"></a> <a href="https://a-nz7.shop"></a> <a href="https://a-nz8.shop"></a> <a href="https://a-nz9.shop"></a> <a href="https://a-nz10.shop"></a> <a href="https://a-nz11.shop"></a> <a href="https://a-nz12.shop"></a> <a href="https://a-nz13.shop"></a> <a href="https://a-nz14.shop"></a> <a href="https://a-nz15.shop"></a> <a href="https://a-nz16.shop"></a> <a href="https://a-nz17.shop"></a> <a href="https://a-nz18.shop"></a> <a href="https://a-nz19.shop"></a> <a href="https://a-nz20.shop"></a> <a href="https://a-nz21.shop"></a> <a href="https://a-nz22.shop"></a> <a href="https://a-nz23.shop"></a> <a href="https://a-nz24.shop"></a> <a href="https://a-nz25.shop"></a> <a href="https://a-nz26.shop"></a> <a href="https://a-nz27.shop"></a> <a href="https://a-nz28.shop"></a> <a href="https://a-nz29.shop"></a> <a href="https://a-nz30.shop"></a>
<p>
<a class="ext-link" href="https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L205-L211"><span class="icon"></span>https://github.com/bbpress/bbPress/blob/09313c9984c55429f3e664ca4383768b68ee34b9/src/includes/extend/akismet.php#L205-L211</a><br />
</p>
<p>
I got same issue ! Can anyone help me out ?<br />
</p>
</div>
</div>
<div class="change" id="trac-change-3-1730739754711984">
<h3 class="change">
<span class="threading">
<span id="comment:3" class="cnum">
<a href="#comment:3">#3</a>
</span>
in reply to:
<a href="#comment:2">↑ 2</a>
</span>
<span class="avatar">
<span class="username-line"><a href="https://profiles.wordpress.org/sirlouen" class="profile-link">
<img src="https://wordpress.org/grav-redirect.php?user=sirlouen&s=48" srcset="https://wordpress.org/grav-redirect.php?user=sirlouen&s=96 2x" height="48" width="48" alt="" /> @<span class="username" data-username="SirLouen" data-nicename="sirlouen"><span class="trac-author">SirLouen</span></span></a></span>
<br /><span class="time-ago"><a class="timeline" href="/timeline?from=2024-11-04T17%3A02%3A34Z&precision=second" title="See timeline at 11/04/2024 05:02:34 PM">2 days</a> ago</span>
</span>
<div class="trac-ticket-buttons">
</div>
</h3>
<div class="trac-ticket-buttons"></div>
<ul class="changes">
<li class="trac-field-cc">
<strong class="trac-field-cc">Cc</strong>
<em>SirLouen</em> added
</li><li class="trac-field-keywords">
<strong class="trac-field-keywords">Keywords</strong>
<em>2nd-opinion</em> added; <em>dev-feedback</em> removed
</li><li class="trac-field-priority">
<strong class="trac-field-priority">Priority</strong>
changed from <em>normal</em> to <em>low</em>
</li><li class="trac-field-severity">
<strong class="trac-field-severity">Severity</strong>
changed from <em>normal</em> to <em>minor</em>
</li><li class="trac-field-type">
<strong class="trac-field-type">Type</strong>
changed from <em>defect (bug)</em> to <em>enhancement</em>
</li>
</ul>
<div class="comment searchable">
<p>
I think that the post status log does the right thing, it informs of what's exactly happening: Akismet caught the spam and then, the post, automatically was set to publish because of the <code>moderate</code> permission<br />
</p>
<p>
Replying to <a class="ticket" href="/ticket/3434#comment:2" title="Comment 2">wpclungz1</a>:<br />
</p>
<blockquote class="citation">
<p>
I got same issue ! Can anyone help me out ?<br />
</p>
</blockquote>
<p>
Still, anyone can easily extend the functionality of this using any of the hooks if needed, either if you want to inhibit that moderators are not bypassed by this module with the <code>bbp_bypass_spam_enforcement</code> filter hook.<br />
</p>
<p>
After reviewing the akismet class code, personally I think that <code>BBP_Akismet::update_post_meta</code> is missing an action hook for adding functionality, like this issue suggests. <br />
</p>
<p>
I'm submitting a patch with a possible solution also including the possibility to access the method <code>update_post_history</code> and being able to extend functionality and do things like proposed in this post, without having to do a bigger overhaul of the Akismet class.<br />
</p>
<p>
For example, using my proposed hook, one could do what is mentioned in the OP:<br />
</p>
<div class="wiki-code"><div class="code"><pre><span class="cp"><?php</span>
<span class="k">function</span> <span class="nf">moderator_spam_notice</span> <span class="p">(</span> <span class="nv">$post_id</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">xdebug_break</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span> <span class="nb">class_exists</span><span class="p">(</span> <span class="s1">'BBP_Akismet'</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span> <span class="nx">current_user_can</span><span class="p">(</span> <span class="s1">'moderate'</span><span class="p">,</span> <span class="nv">$post_id</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="nv">$akismet</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">BBP_Akismet</span><span class="p">();</span>
<span class="nv">$akismet</span><span class="o">-></span><span class="na">update_post_history</span> <span class="p">(</span>
<span class="nv">$post_id</span><span class="p">,</span>
<span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'Akismet spam check overruled. Post status was published because user is a moderator'</span> <span class="p">),</span>
<span class="s1">'moderator-bypass'</span><span class="p">,</span>
<span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nx">add_action</span><span class="p">(</span> <span class="s1">'bbp_akismet_update_post_meta'</span><span class="p">,</span> <span class="s1">'moderator_spam_notice'</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span> <span class="p">);</span>
</pre></div></div><p>
PS: I would also add <code>static</code> to <code>update_post_history</code> because its not a function that need object context to work but for the proposed patch I'm leaving as-is.<br />
</p>
</div>
</div>
<div class="change" id="trac-change-4-1730739826898734">
<h3 class="change chat-bot prbot with-context">
<span class="avatar">
<span class="username-line">
<img src="https://wordpress.org/grav-redirect.php?user=prbot&s=48" srcset="https://wordpress.org/grav-redirect.php?user=prbot&s=96 2x" height="48" width="48" alt="" />
<p>
<em>This ticket was mentioned in <a class="ext-link" href="https://github.com/bbpress/bbPress/pull/25"><span class="icon"></span>PR #25</a> on <a class="ext-link" href="https://github.com/bbpress/bbPress/"><span class="icon"></span>bbpress/bbPress</a> by <a class="ext-link" href="https://profiles.wordpress.org/sirlouen/"><span class="icon"></span>@SirLouen</a>.</em><br />
</p>
</span>
<br /><span class="time-ago"><a class="timeline" href="/timeline?from=2024-11-04T17%3A03%3A46Z&precision=second" title="See timeline at 11/04/2024 05:03:46 PM">2 days</a> ago</span>
</span>
<span class="threading">
<span id="comment:4" class="cnum">
<a href="#comment:4">#4</a>
</span>
</span>
<div class="trac-ticket-buttons">
</div>
</h3>
<ul class="changes">
<li class="trac-field-keywords">
<strong class="trac-field-keywords">Keywords</strong>
<em>has-patch</em> added
</li>
</ul>
<div class="comment searchable">
<p>
Trac Issue:<br />
<a class="ext-link" href="https://bbpress.trac.wordpress.org/ticket/3434"><span class="icon"></span>https://bbpress.trac.wordpress.org/ticket/3434</a><br />
</p>
</div>
</div>
</div>
</div>
<div id="help"><strong>Note:</strong> See
<a href="/wiki/TracTickets">TracTickets</a> for help on using
tickets.</div>
</div>
<script type="text/javascript">
jQuery.loadStyleSheet("/pygments/trac.css", "text/css");
</script>
<div id="altlinks">
<a class="preferences-link" href="/prefs">Trac UI Preferences</a>
<h3>Download in other formats:</h3>
<ul>
<li class="first">
<a rel="nofollow" href="/ticket/3434?format=csv" class="csv">Comma-delimited Text</a>
</li><li>
<a rel="nofollow" href="/ticket/3434?format=tab" class="tab">Tab-delimited Text</a>
</li><li class="last">
<a rel="nofollow" href="/ticket/3434?format=rss" class="rss">RSS Feed</a>
</li>
</ul>
</div>
</div>
<div id="footer">
<div class="links">
<p>
See also:
<a href="http://wordpress.org">WordPress.org</a> •
<a href="http://bbpress.org">bbPress.org</a> •
<a href="http://buddypress.org">BuddyPress.org</a> •
<a href="http://ma.tt">Matt</a> •
<a href="http://bbpress.org/feed/" title="RSS Feed for Articles">Blog RSS</a>
</p>
</div>
<div class="details">
<p>
<a href="http://twitter.com/bbpress" class="twitter">Follow bbPress on Twitter</a> •
<a href="http://bbpress.org/about/gpl/">GPL</a> •
<a href="http://bbpress.org/contact/">Contact Us</a> •
<a href="http://bbpress.org/terms/">Terms of Service</a>
</p>
</div>
</div>
<script>
var wpTracCurrentUser = "anonymous";
</script>
<script src="https://s.w.org/style/js/navigation.min.js?20190128"></script>
<script src="https://s.w.org/style/trac/jquery.caret.min.js?ver=2015-02-01"></script>
<script src="https://s.w.org/style/trac/jquery.atwho.min.js?ver=1.0.1"></script>
<script src="https://s.w.org/style/trac/wp-trac.js?220"></script>
</body>
</html>