[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!
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!
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.
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.
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?
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?
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!
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())
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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.