We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Disable Spam Module on Core

How Do I?

JosephA.'s avatar
JosephA.
21 posts
9 years ago
JosephA.'s avatar JosephA.

[I mentioned the following in another section (piggybacking on an older thread), but it’s really a “how to” question.]

I just updated to 3 – core. There is no Spam Module in the core installation. When I try submit a comment, I get the following error:

Fatal error: Class ‘EllisLab\Addons\Spam\Service\Spam’ not found in /system/ee/EllisLab/ExpressionEngine/app.setup.php on line 133

In app.setup.php around 133, I have:

‘Spam’ => function($ee) { return new Spam(); },

I cannot disable the spam module in the normal CP manner because I don’t have it. Is there a way to disable it in config or in the files?

Thanks!

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil

I just installed and uninstalled the Spam Module on my dev setup. The only difference that I could make out was a bunch of exp_spam_* tables (kernels, parameters, training, trap) and an entry in exp_modules. My suggestion would be:

1.) Make a backup and verify that it works.

2.) Take a deep breath.

3.) Drop tables exp_spam_kernels, exp_spam_parameters, exp_spam_training, exp_spam_trap

4.) Remove spam from exp_modules

5.) Test thoroughly and roll back if it doesn’t work.

Good luck!

       
Seth Barber's avatar
Seth Barber
172 posts
9 years ago
Seth Barber's avatar Seth Barber

Hi Joseph,

Congratulations, you found a bug in Core! We’re working on fixing this but in the meantime if you edit system/ee/EllisLab/Addons/comment/mod.comment.php around line 2313 you should find:

$is_spam = ee('Spam')->isSpam($comment_string);

Replace that with:

$is_spam = FALSE;

This is only a workaround, but it should get you up and running with comments.

       
Ingo Wedler's avatar
Ingo Wedler
63 posts
9 years ago
Ingo Wedler's avatar Ingo Wedler

Ingmar, the CORE version comes WITHOUT the Spam module, that’s the culprit. If you try to use the comment modul, you get this Spam module related errors, because there’s no Spam module installed.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil

But that’s precisely the problem: EE thinks that the Spam module is still installed (since it came with EE1), when he no longer has access to it. The spam module is optional (I haven’t enabled it on a lot of sites), so removing it from the db should, in theory, work. Or, as an afterthought: disabling the module before upgrading should work as well.

       
Ingo Wedler's avatar
Ingo Wedler
63 posts
9 years ago
Ingo Wedler's avatar Ingo Wedler

Ingmar, even with a fresh clean install of EE3 and DB you get the error, i ran in the same issue…

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil

Right, I didn’t know that. Obviously this changes things. It’s officially a bug, then 😊

       
JosephA.'s avatar
JosephA.
21 posts
9 years ago
JosephA.'s avatar JosephA.

Thank you for your research and input!

I changed the line as instructed. Then, I tested the comments, both as a “guest” and as myself. In both cases, I got the following error:

Fatal error: Call to a member function updateAuthorStats() on a non-object in /home/protected/system/ee/EllisLab/ExpressionEngine/Model/Comment/Comment.php on line 90

However, the comments took. They appeared in my CP (they’re moderated).

So, the comments work, but the user won’t know that.

Line 90 of comment.php states (in bold):

public function onAfterInsert() { $this->Author->updateAuthorStats(); $this->updateCommentStats(); }

Progress, but what now? Is it a setting issue?

       
JosephA.'s avatar
JosephA.
21 posts
9 years ago
JosephA.'s avatar JosephA.

I still haven’t come up with a solution. I emptied the exp_comments table in my database, thinking that that might help. It did not.

If you refresh the blank page that occurs after submitting a comment, a notification page states that the captcha was entered incorrectly. Yet, this is not true, as the comment did register – but the reader who submits a comment will not know that.

Any ideas?

       
Seth Barber's avatar
Seth Barber
172 posts
9 years ago
Seth Barber's avatar Seth Barber

HI Joseph,

In system/ee/EllisLab/ExpressionEngine/Model/Comment/Comment.php replace the onAfterInsert() function with:

public function onAfterInsert()
 {
  if ($this->Author)
  {
   $this->Author->updateAuthorStats();
  }
  $this->updateCommentStats();
 }
       
JosephA.'s avatar
JosephA.
21 posts
9 years ago
JosephA.'s avatar JosephA.

That worked like a charm. Thank you!

       
JosephA.'s avatar
JosephA.
21 posts
7 years ago
JosephA.'s avatar JosephA.

Here it is almost two years later, and I am having a similar issue after upgrading to 4. I get the following message when I try to look at new comments waiting for moderation:

Fatal error: Call to a member function isInstalled() on null in … /ee/EllisLab/ExpressionEngine/Controller/Publish/Comments.php on line 153

Line 153 is “if (ee()->cp->allowed_group(‘can_moderate_spam’) && ee(‘Addon’)->get(‘spam’)->isInstalled())” below:

// if there are Spam comments, and the user can access them, give them a link if (ee()->cp->allowed_group(‘can_moderate_spam’) && ee(‘Addon’)->get(‘spam’)->isInstalled()) { $spam_total = ee(‘Model’)->get(‘Comment’) ->filter(‘site_id’, ee()->config->item(‘site_id’)) ->filter(‘status’, ‘s’) ->count(); $spam_link = ee(‘CP/URL’)->make(‘addons/settings/spam’, array(‘content_type’ => ‘comment’)); ee(‘CP/Alert’)->makeInline(‘comments-form’) ->asWarning() ->withTitle(lang(‘spam_comments_header’)) ->addToBody(sprintf(lang(‘spam_comments’), $spam_total, $spam_link)) ->now(); }

I assume the problem is the lack of the spam module in the core. I looked for the previous phrase in the old fix, but it doesn’t appear to be in the new code. Please help!

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Hey Joseph, sorry about that. To fix it prior to the next available update, change line 153 of system/ee/EllisLab/ExpressionEngine/Controller/Publish/Comments.php to:

if (ee()->cp->allowed_group('can_moderate_spam') && ee('Addon')->get('spam') && ee('Addon')->get('spam')->isInstalled())

and line 46 of system/ee/EllisLab/Addons/comment/ext.comment.php to:

if ($spam_addon && $spam_addon->isInstalled())
       
JosephA.'s avatar
JosephA.
21 posts
7 years ago
JosephA.'s avatar JosephA.

Thank you for the quick response. I changed the two files as you suggested. Now, when I click on the “new comments” or “awaiting moderation” links on the control panel, I just get a blank screen. The address is …/cp/publish/comments&filter_by_status=p&S=44db5822c7c6e635fdaf3680c5c337cd.

Is there a setting that I have to change, too? Thanks for your time.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

No, no settings. Might be a cut and paste error or file system error when you saved the file perhaps? In your admin.php and system/index.php files, set $debug to 1 to make sure that non-fatal PHP errors will be displayed.

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.