Well, I guess I revived the thread myself, by posting that I had a little solution.
The problem is that it's just a hack which has to be implemented on a module by module basis. There is also a difference whether you use PHP 4 or PHP 5, so you'll have to experiment a little on your own. It also seems you are interested in implementing it on the system-wide comment function. I don't know where the comment function writes the comment to the database, or where otherwise to catch a comment and test it against Akismet in the most efficient way. I think one could dig a little and find a good spot to apply the hack. But there're more qualified people here to help out with that bit of information. It must also depend on the XOOPS version you're using. The question to be asked being:
Where can I catch the system as it is writing a comment to the database in XOOPS version XY?Now, if you want to use it on some individual module where your users can submit something, You also will have to find the correct spot in the php code where the submission is written to the database. I think you have a fair chance of finding it if you look for the words "INSERT INTO" in files called "post.php" or "sumbit.php" inside the module folder.
Once you found a good place for your operation and are ready to go, you, of course, need the Akismet class for the PHP version your server is running. In my last post is a link to a page which links to the two in question, for PHP4 and PHP5. You also need the Akismet API key. But it looks like you have one already.
You drop that Akismet class (a php file) somewhere handy in your file structure. Let's assume into the "class" folder, because it sounds like a good place for it
Then the operation:
1. You call the class from the place you have identified as a good one to perform the check, again I assume it's immediately before a line which instructs the database server to write the comment to the database. (I think that's a good place, because that's where you have performed all your local checks, and the variables are all set up).
2. You identify the relevant variables which you pass on to the Akismet class. At least, you need to know what variable the body of the submission comes wrapped into. In the code below, you replace the variables you would have to replace "$submission_author" and "$submission_body" with the relevant variables from the module you're hacking.
2. You perform the check
3. If spam check returns positive, you abort the dtabase writing process and return something, perhaps send yourself an email if you don't have a problem with shifting to spamming from your blog to your email account.
4. If spam check returns negative, you just let the script do whatever it wanted to do anyway.
Both Akismet classes (for PHP4 and 5) come with instructions and a ready made code snippet which you slightly adapt, and then can use to call the relevant function. For me, WF-Links and
PHP5, this code used to call the class/function looks something like this (red needs attention):
// start Akismet hack
include_once [color=CC0000]XOOPS_ROOT_PATH . '/class/Akismet.class.php'[/color];
$WordPressAPIKey = '[color=CC0000]yourAkismetkey[/color]';
$MyBlogURL = '[color=CC0000]http://www.yoursite.tld/modules/whatevermodule[/color]';
$name = [color=CC0000]$submission_author[/color];
$comment = [color=CC0000]$submission_body[/color];
$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
$akismet->setCommentAuthor($name);
$akismet->setCommentAuthorEmail($email);
akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($comment);
$akismet->setPermalink('[color=CC0000]http://www.yoursite.tld/modules/linkToAnActualPageWhereUsersCanSubmitSomething[/color]');
if($akismet->isCommentSpam()){
// Here, the routine you want to perform when spam is caught
redirect_header( 'index.php', 2, [color=CC0000]'Your submission looks like spam to us'[/color]);
exit();
}
// end Akismet, store the submission normally
From there, again, you hand it back to the original script which should go on with something like a line containing "INSERT INTO" and which stores the submission in the database.
This will just stop everything identified by Akismet as spam and never tell you about it. If you care about a notification, you can send yourself an email, or you can also create a database table to which to write your spam. But that's a more complex operation.
If you only want to check if user hasn't logged in or is anonymous, you have to wrap the entire thing into the corresponding test.
Hope that helps a little. Sorry I cannot be more precise, but it depends on a whole lot of things. Perhaps you can do something with it.