Advertisement:
A2Hosting

Author Topic: Akismet Spam Protection  (Read 122863 times)

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,155
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Akismet Spam Protection
« on: December 29, 2006, 02:19:52 AM »
Link to Mod
Rate this Mod

IMPORTANT!
An issue has crept into the Akismet 1.1.1 mod which will prevent people from creating new topics. A fixed package has been uploaded (Akismet_1-1-1_Fixed1.zip). If you installed the original Akismet 1.1.1 package (only about 20 people did), then please see this post.

Akismet Spam Protection for SMF

What is it?
This is a SMF modification implementing the Akismet spam protection service. The MOD requires SMF 1.1 Final or higher (but it may still work on SMF 1.1 RC3, that was not tested).
NOTE: If you were testing out the Beta version of this mod, you'll need to uninstall it before installing version 1.0!

How do I use it?
Firstly, you'll need to sign up for a free API key at http://wordpress.com/api-keys/. Then, install this mod via the SMF Package Manager. Once it's installed, there will be a new 'Akismet Configuration' option in the admin panel, under the 'Forum' section. Enter your API key in, and you're all set!


How do I know it's working?
You test it, of course! Simply write a new topic with the subject of 'akismet-test-123', and it will be classified as spam by the mod. This tests that the mod is installed correctly. An additional test is writing a guest post with a name of 'viagra-test-123'. Any message with this name will be marked as spam by the Akismet service. If this message is also detected as spam, then everything is working perfectly :)

How do I get it working in other themes?
The spam warning will be shown to users using the default theme, but if you use a custom theme, you'll need to edit it.
Open Themes/[theme name]/Display.template.php, and find:
Code: [Select]
// Show the page index... "Pages: [1]".
echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0">
Add before:
Code: [Select]
// ---- Begin Akismet Mod 1.0 ----
// If this person was an evil one, and sent spam, let's give them a "friendly" message :-)
if (isset($_GET['spam']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="color: red; font-size: 14px" align="center">', $txt['akismet_spam_warning'], '</div>
<hr width="100%" size="1" class="hrcolor" />';
// ---- End Akismet Mod 1.0 ----

That's for the warning at the top of the page. For the warning next to the post's subject, find:
Code: [Select]

<a href="', $message['href'], '">', $message['subject'], '</a>
</div>';
Replace with:
Code: [Select]
<a href="', $message['href'], '">', $message['subject'], '</a>';
// ---- Begin Akismet Mod 1.0 ----
if ($message['spam'] == 1)
echo '
<span style="color: red">', $txt['akismet_flagged'],'</span>';
// ---- End Akismet Mod 1.0 ----

echo '
</div>';
Note that this may differ depending on your theme. If in doubt, write a comment, and I'll see how to modify your theme.

Changelogs

1.0 --> 1.1
 - If server is inaccessible, mark post as Non-spam and write error to errorlog
 - Minor changes to language strings (use single quotes (') instead of double quotes ("))

0.1 --> 1.0
 - Updated MOD files to comply with SMF standards
 - Now parses BBCode in posts in the Akismet admin panel
 - Added version information to admin section
 - Now marks any posts with subject of 'akismet-test-123' as spam (for testing purposes)
 - In Subs-Post.php, use $posterOptions and $msgOptions arrays rather than $_POST variables
 - Moved 'Akismet Configuration' option from Configuration heading to Forum heading
 - Moved position of Spam warning above the topic buttons
 - Moved 'Flagged as spam' message next to subject, rather than under it

Known Issues
 - Only admins can moderate the spam comments (Delete all spam, Mark as 'Not Spam'). This may change in a future release, to also allow moderators access.
 - Statistics may be incorrect after deleting spam messages. Recounting all the statistics should fix this
 - There is currently no way to mark existing posts as spam (false negatives).


(c) 2006, 2007 DanSoft Australia - http://www.dansoftaustralia.net/. This mod is released under the same license agreement as SMF itself.
Version: 1.1 (Build 3)
Release Date: 29th December 2006
« Last Edit: January 06, 2007, 09:03:33 PM by Daniel15 »
Community Suite - Take your forum to the next level built for SMF, Gallery,Store,Classfieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - Portal System for SMF
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline RoarinRow

  • Full Member
  • ***
  • Posts: 662
  • Gender: Male
  • Ride my AV!
    • Avalanche Style
Re: Akismet Spam Protection
« Reply #1 on: December 29, 2006, 02:44:35 AM »
Very cool, every little bit helps.   8)

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Offline RoarinRow

  • Full Member
  • ***
  • Posts: 662
  • Gender: Male
  • Ride my AV!
    • Avalanche Style
Re: Akismet Spam Protection
« Reply #2 on: December 29, 2006, 03:12:29 AM »
Installation went well my my 1.1.1 forums.

Just got this error after deleting a test post that was marked not as spam:

Error connecting to host: rest.akismet.com Error number: 0 Error message: Undefined error: 0

Edit - I had to un-install cause it was clause slowness when hit and getting to the forum page. 
« Last Edit: December 29, 2006, 03:28:38 AM by RoarinRow »

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Offline EdwinK

  • Jr. Member
  • **
  • Posts: 370
  • Gender: Male
  • Free is always better
Re: Akismet Spam Protection
« Reply #3 on: December 29, 2006, 05:27:58 AM »
I like it very much. Has already catched many spam on my blog, so I hope it will do a good job on SMF as well.

Just not sure about editing my DilbertMC theme. I've screwed up the theme several times already :(
« Last Edit: December 29, 2006, 09:19:51 AM by EdwinK »

Offline wudzzy

  • Semi-Newbie
  • *
  • Posts: 10
Re: Akismet Spam Protection
« Reply #4 on: December 30, 2006, 02:56:14 AM »
how to install this mod ?
i just login as admin - click to admin - package manager - download package , then upload it - browse package , then click to apply mod , then i have message :
Installations actions for "Akismet Spam Blocking":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

what i should do ?

Offline EdwinK

  • Jr. Member
  • **
  • Posts: 370
  • Gender: Male
  • Free is always better
Re: Akismet Spam Protection
« Reply #5 on: December 30, 2006, 06:19:17 AM »
Are you sure you are using SMF 1.1 Final (or 1.1.1). I've got it working on two forums without a problem.

Offline wudzzy

  • Semi-Newbie
  • *
  • Posts: 10
Re: Akismet Spam Protection
« Reply #6 on: December 30, 2006, 06:26:59 AM »
Are you sure you are using SMF 1.1 Final (or 1.1.1). I've got it working on two forums without a problem.
i have SMF 1.1.1. may be something wrong with board configuration , i just load smf_settings table and the find variable :
('package_path', 'httpdocs/forum') - is this correct ? or it should be
('package_path', '/usr/local/psa/home/vhosts/mydomain.tld/httpdocs/forum') - or it's wrong too ?

i just try to install mods on my home pc and it's installed perfectly , but i still have this error on linux server ... may be something wrong with permissions or other settings ? how to find errors ?
« Last Edit: December 30, 2006, 07:50:42 AM by wudzzy »

Offline wudzzy

  • Semi-Newbie
  • *
  • Posts: 10
Re: Akismet Spam Protection
« Reply #7 on: December 30, 2006, 08:29:52 AM »
also php in safe mode , is this a problem for mods installation ?

Offline razor1394

  • Newbie
  • *
  • Posts: 1
Re: Akismet Spam Protection
« Reply #8 on: January 02, 2007, 08:05:35 AM »
Anyone who could give me a hand?

The mod installed fine on SMF 1.1.1 but it won't show up in the admin panel under "forum".

This error keeps popping up in the error log:

Quote
8: Undefined index: akismet_conf
File: /var/www/localhost/htdocs/forum/Sources/Subs.php
Line: 2767

Offline mrselnombre

  • Jr. Member
  • **
  • Posts: 207
  • Gender: Female
  • wot?
    • Total Twaddle
Re: Akismet Spam Protection
« Reply #9 on: January 02, 2007, 09:00:05 AM »
it works fine for me, but the boardindex page of my forum has been slowed down. I know it is this mod as it sped back up when i uninstalled it.
7 seconds to load a page is too long.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

Offline Elegant John

  • Jr. Member
  • **
  • Posts: 120
Re: Akismet Spam Protection
« Reply #10 on: January 03, 2007, 01:07:53 PM »
This damned thing crashed my forum, not once, but twice, as I was stupid enough to try a reinstall

Everything installed without error but when making posts, recieved fatal errors.

Uninstalled package without incident, but was unable to use board, until all source files which were modified were replaced with virgin ones from the SMF 1.1.1 package.

And it is a shame too, becaise I use AKISMET on my blogs without problems and with great success.

Perhaps that is where it needs to stay. With WORDPRESS.

Sorry guys, but I reported this as an unsafe mod.

Offline Bill-Kill

  • Semi-Newbie
  • *
  • Posts: 30
Re: Akismet Spam Protection
« Reply #11 on: January 03, 2007, 07:56:25 PM »
I don't think so. I installed it and everything has worked fine for me. I love this mod, thank you Daniel once again!! Your shop mod was amazing and so is this!

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,216
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: Akismet Spam Protection
« Reply #12 on: January 03, 2007, 10:02:47 PM »
Quote
Just not sure about editing my DilbertMC theme. I've screwed up the theme several times already
Do you still require help with this?

Quote
('package_path', 'httpdocs/forum') - is this correct ? or it should be
('package_path', '/usr/local/psa/home/vhosts/mydomain.tld/httpdocs/forum') - or it's wrong too ?
I believe that the second one is correct

Quote
also php in safe mode , is this a problem for mods installation ?
As far as I know, it should work in safe mode, but I have no idea (as I haven't tested it)

Quote
it works fine for me, but the boardindex page of my forum has been slowed down. I know it is this mod as it sped back up when i uninstalled it.
7 seconds to load a page is too long.
Try this:
Install it, and open Sources/BoardIndex.php. Find:
Code: [Select]
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_BOARD = b.ID_BOARD AND m.spam = 0)
Replce with:
Code: [Select]
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
I didn't think that this would make a performance difference, but apparently it does. If changing this speeds up your forum, I'll change this behavior in the next release.

Quote
This damned thing crashed my forum, not once, but twice, as I was stupid enough to try a reinstall

Everything installed without error but when making posts, recieved fatal errors.
What error were you getting?

Quote
This error keeps popping up in the error log:

Quote
8: Undefined index: akismet_conf
File: /var/www/localhost/htdocs/forum/Sources/Subs.php
Line: 2767
Could you please check that $txt['akismet_conf'] is in your Themes/default/languages/Modifications.english.php file? Can you access the Akismet Configuration by going directly to index.php?action=akismet ?
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline mrselnombre

  • Jr. Member
  • **
  • Posts: 207
  • Gender: Female
  • wot?
    • Total Twaddle
Re: Akismet Spam Protection
« Reply #13 on: January 04, 2007, 02:27:56 AM »
that code does speed it up, but caused a minor bug. i pmed you the details.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

Offline RoarinRow

  • Full Member
  • ***
  • Posts: 662
  • Gender: Male
  • Ride my AV!
    • Avalanche Style
Re: Akismet Spam Protection
« Reply #14 on: January 04, 2007, 02:48:09 AM »
I wanted the extra protection, but not at the cost of a slower forum too.  Looking forward to the next release that will address this performance issue   8)

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,216
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: Akismet Spam Protection
« Reply #15 on: January 05, 2007, 02:47:17 AM »
OK, version 1.1.1 is out, and it should fix the speed issues.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline mrselnombre

  • Jr. Member
  • **
  • Posts: 207
  • Gender: Female
  • wot?
    • Total Twaddle
Re: Akismet Spam Protection
« Reply #16 on: January 05, 2007, 02:50:09 AM »
does it have differences in the template changes?
I'm wondering if i have to remove from all the templates before uninstalling and reinstalling.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,216
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: Akismet Spam Protection
« Reply #17 on: January 05, 2007, 04:35:15 AM »
No, no differences. The only changes are in Sources/ManageBoards.php and Sources/Subs-Post.php
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline mrselnombre

  • Jr. Member
  • **
  • Posts: 207
  • Gender: Female
  • wot?
    • Total Twaddle
Re: Akismet Spam Protection
« Reply #18 on: January 05, 2007, 06:03:17 AM »
thank you!!
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

Offline mrselnombre

  • Jr. Member
  • **
  • Posts: 207
  • Gender: Female
  • wot?
    • Total Twaddle
Re: Akismet Spam Protection
« Reply #19 on: January 05, 2007, 06:19:58 AM »
This new version has a bug too
"Column count doesn't match value count at row 1
File: /home/totaltwa/public_html/board/Sources/Subs-Post.php
Line: 1619" when anyone starts a new topic.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.