Core: Akismet Extension Not Working Properly

Created on 9 Sep 2019  路  11Comments  路  Source: flarum/core

Bug Report

Current Behavior
Akismet extension not working properly (or at all for that matter). See forum post:

Steps to Reproduce

  1. Install the Akismet extension (v0.1.0-beta.9): $ composer require flarum/akismet
  2. Clear cache (just in case): $ php flarum cache:clear
  3. Run migrations (just in case): $ php flarum migrate
  4. Enable the extension via Admin side
  5. Enter API Key
  6. Save Changes

Expected Behavior
I expect the extension to work and prevent spam. I do not see any calls to Akismet from my forum.

Screenshots
Screen Shot 2019-09-09 at 09 48 36

Environment

  • Flarum version: v0.1.0-beta.9
  • Website URL: Prefer Not To Say
  • Webserver: NGINX
  • Hosting environment: VPS
  • PHP version: v7.2.1-1
  • Browser: Chrome (any version), Safari (any version), Firefox (any version)
PHP version: 7.2.1-1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection,
SPL, sodium, session, standard, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom,
mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imap, intl, json, exif, msgpack, mysqli,
pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, soap,
sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip,
memcached, Zend OPcache
+----------------------+---------------+--------+
| Flarum Extensions    |               |        |
+----------------------+---------------+--------+
| ID                   | Version       | Commit |
+----------------------+---------------+--------+
| flarum-approval      | v0.1.0-beta.8 |        |
| flarum-bbcode        | v0.1.0-beta.8 |        |
| flarum-emoji         | v0.1.0-beta.8 |        |
| flarum-lang-english  | v0.1.0-beta.9 |        |
| flarum-flags         | v0.1.0-beta.9 |        |
| flarum-likes         | v0.1.0-beta.9 |        |
| flarum-lock          | v0.1.0-beta.9 |        |
| flarum-markdown      | v0.1.0-beta.9 |        |
| flarum-mentions      | v0.1.0-beta.9 |        |
| flarum-sticky        | v0.1.0-beta.9 |        |
| flarum-subscriptions | v0.1.0-beta.9 |        |
| flarum-suspend       | v0.1.0-beta.9 |        |
| flarum-tags          | v0.1.0-beta.9 |        |
| fof-recaptcha        | 0.1.1         |        |
| flagrow-upload       | 0.7.1         |        |
| flarum-statistics    | v0.1.0-beta.9 |        |
| fof-reactions        | 0.1.0         |        |
| fof-links            | 0.2.1         |        |
| reflar-stopforumspam | 0.1.5         |        |
| fof-spamblock        | 0.2.1         |        |
| flarum-akismet       | v0.1.0-beta.9 |        |
+----------------------+---------------+--------+
Base URL: https://site.com
Installation path: /path/to/site/public
Debug mode: off

Additional Information:
I ran a test to see if my server was denying the connection, etc. but it appears to be working via command-line (just not in Flarum).

user@hostname:~$ curl -d "key=[API_KEY]&blog=[SITE].com&comment_type=forum-post&user_ip=1.1.1.1&comment_author=viagratest123&[email protected]&comment_content=asdfa lsdgjsdg." -X POST https://[API_KEY].rest.akismet.com/1.1/comment-check
true
user@hostname:~$

Most helpful comment

We might want to keep this open as a reminder to add configuration options relating to groups to the Akismet extension. Will let another core member decide.

All 11 comments

Just noticed that clicking the Spammer button on a User's profile actually deletes all of the User's posts and Suspends the User, it just doesn't send an API call to Akismet.

So all-in-all the extension is working on the Flarum side, just not on the Akismet API side.

@JediKev The "Spammer" button is added by fof/spamblock. All the button does is (1) delete all the user's posts, (2) delete all the user's discussions, (3) suspend the user. If reflar/stopforumspam is enabled, it will report the user to SFS.

The thing is, the extension doesn't trigger any events. It directly modifies the deleted status of all the posts from the DB.

The Akismet extension only analyzes new posts.

Would this be the issue you are encountering ? If so, this is intended in a third-party extension, and not a core extension one.

@datitisev

The "Spammer" button is added by fof/spamblock. All the button does is (1) delete all the user's posts, (2) delete all the user's discussions, (3) suspend the user. If reflar/stopforumspam is enabled, it will report the user to SFS.

The thing is, the extension doesn't trigger any events. It directly modifies the deleted status of all the posts from the DB.

My sincere apologies, I installed StopForumSpam, SpamBlock, and Akismet all at once and didn't realize the Spammer button was added by SpamBlock.

Would this be the issue you are encountering ? If so, this is intended in a third-party extension, and not a core extension one.

No, my original issue still stands, when users create new posts it does not check with Akismet first.

Cheers.

@JediKev Looks like the Akismet extension only validates posts of users with no groups.

@datitisev

Dude....I think that's it! I've been beating my head against the wall for ages trying to figure out if it was my environment, if the extension was not installed properly, etc. I will test this with a User that has no group and get back to you but i'm almost positive this is it since we auto-add users to groups on sign up (to avoid having to add them to groups manually).

Do you know why it's not checking with Akismet when users have groups? Basically, would there be any down-side to me removing that check?

Cheers.

@JediKev Probably to avoid marking posts from privileged users as spam... though I'm not sure why it's not a setting or permission.

@datitisev

~Okay, so I tested this by creating a Discussion with a User who has no group and I still don't see an API call on the Akismet site...shouldn't I see an API call on Akismet if this extension was working~

I had to restart NGINX and PHP-FPM for some reason but now I see the calls! Thank you so much for your assistance.

I will close this now.

Cheers.

We might want to keep this open as a reminder to add configuration options relating to groups to the Akismet extension. Will let another core member decide.

Would make more sense to run akismet on the first N posts and edits of a user.

@luceos

Something like this?
https://github.com/flarum/akismet/pull/11

Please feel free to suggest any changes as you see fit.

Cheers.

I am closing this because the issue has deviated quite far from what was originally discussed. The discussion is good and useful, but tickets should be immediately actionable.

We might want to keep this open as a reminder to add configuration options relating to groups to the Akismet extension. Will let another core member decide.

If you guys still think this is important, feel free to create an issue specifically with this suggestion. And don't forget to reference this issue as documentation. :grin:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ardacebi picture ardacebi  路  4Comments

luceos picture luceos  路  3Comments

jordanjay29 picture jordanjay29  路  3Comments

tobyzerner picture tobyzerner  路  4Comments

jordanjay29 picture jordanjay29  路  3Comments