yes it does (and does so on here as well!).
I’m just a helper here, not a bbpress author.
I don’t run akismet on my test site. Are you able to replicate the problem so that we can check a fix if I am able to work up some code?
just posting this link here for reference for me 🙂
Akismet causing “recent topics” problem?
Hi Robin. Thank you for looking at this. Yes, I can replicate the problem and test a fix. In fact, I have the described situation on my forum right now:
https://www.totalsync.com/forum/
And it is likely to stay this way for the next few days. If necessary I can also recrate it manually.
ok, give this a try – it may or may not do the trick !!
add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
function rew_spam_update_last_active ($topic_id) {
//this function tests if a new topic has been marked as spam by Akismet. If so then the last active date will be wrong
//So we use topic walker to recalculate it
if (!empty (get_post_meta( $topic_id, '_bbp_akismet_user_result' ))) {
bbp_update_topic_walker ($topic_id) ;
}
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
if it works for a topic, then I’ll do the code for a reply, which is basically changing mthe word topic to reply 🙂
Thank you, Robin. I added the snipped, and it partially worked. The anchor text “time ago” now reflects the time of the latest good post. However the URL is for the latest spam post.
I started digging a bit through bbpress code. It looks like if the fix was inside bbp_topic_freshness_link() it would be much easier to test, as we would not need to wait for a new spam post to test the fix. And perhaps make decisions based on the wp_post status having the value “publish”. This way the solution would not be specific to Akismet. But I am really too new to WordPress coding and bbPress to be making this kind of changes myself.
FYI, post ID 1768 is the post that just came in.
‘It looks like if the fix was inside bbp_topic_freshness_link() it would be much easier to test, ;’
agree but it just wouldn’t work there, that is not where or when the issue is occurring.
Try
add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
function rew_spam_update_last_active ($topic_id) {
//this function tests if a new topic has been marked as spam by Akismet. If so then the last active date will be wrong
//So we use topic walker to recalculate it
if (!empty (get_post_meta( $topic_id, '_bbp_akismet_user_result' ))) {
bbp_update_topic_walker ($topic_id, '', 0, 0, true) ;
}
}
Still the same result with the new code.
But I noticed that emptying the spam folder causes “Last Post” link to change to the correct value. So there is some code in bbpress that can fix the link (I am guessing by changing something in the database?).
So there is some code in bbpress that can fix the link (I am guessing by changing something in the database?).
yes it is the function ‘bbp_update_topic_walker ‘ called in my code 🙂 🙂
I’ll look further at why it isn’t recalculating based in that info
maybe it’s the if function, try
add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
function rew_spam_update_last_active ($topic_id) {
//this function tests if a new topic has been marked as spam by Akismet. If so then the last active date will be wrong
//So we use topic walker to recalculate it
bbp_update_topic_walker ($topic_id, '', 0, 0, true) ;
}
It’s not the answer, but might help get to the solution problem
or might not – I’m trying to look at this in limited free time and trying not to get sucked into too deeper a code dive 🙂
Robin, I applied your code change. Will report results once I have them.
Robin, your code change worked for new topics. Did you say we would need an additional code change for replies?