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
7 years ago
JosephA.'s avatar JosephA.

You guys rock. I changed the debug setting, and now the error message reads:

“Fatal error: Namespace declaration statement has to be the very first statement in the script in … system/ee/EllisLab/ExpressionEngine/Controller/Publish/Comments.php on line 10”

So, line 10 reads currently:

“namespace EllisLab\ExpressionEngine\Controller\Publish;”

How should I change it? I apologize for my ignorance.

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

That namespace line is correct, but it’s indicating that code has been added above that line. Perhaps the text editor you used added something? Can you paste the top 20 or so lines of the file as it sits on your server?

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

Here is the opening:

<?php
/**
 * ExpressionEngine (https://expressionengine.com)
 *
 * @link      https://expressionengine.com/
 * @copyright Copyright (c) 2003-2017, EllisLab, Inc. (https://ellislab.com)
 * @license   https://expressionengine.com/license
 */

namespace EllisLab\ExpressionEngine\Controller\Publish;

use EllisLab\ExpressionEngine\Library\CP\Table;

use EllisLab\ExpressionEngine\Controller\Publish\AbstractPublish as AbstractPublishController;
use EllisLab\ExpressionEngine\Service\Model\Query\Builder;

/**
 * Publish/Comments Controller
 */
class Comments extends AbstractPublishController {

 public function __construct()
 {
  parent::__construct();

  if ( ! ee()->cp->allowed_group_any(
   'can_moderate_comments',
   'can_edit_own_comments',
   'can_delete_own_comments',
   'can_edit_all_comments',
   'can_delete_all_comments'
   ))
  {
   show_error(lang('unauthorized_access'), 403);
  }
 }
       
JosephA.'s avatar
JosephA.
21 posts
7 years ago
JosephA.'s avatar JosephA.

The forum’s formatting doesn’t capture the line breaks.

Well, now it’s working. OK.

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

Thanks Joseph! I edited your post to fix that for you, your code wasn’t in a code fence (see the “Use Markdown” link for formatting tips).

That looks correct though, and doesn’t match the PHP compilation error you’re getting. What application did you use to modify the file? Might be an invisible control character perhaps.

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

LibreWriter, which came up as the default. I’ll try to open it in a simple text editor. It saved as simple text. but something may have snuck in.

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

OK, I just downloaded the file, opened it with a text editor, copied everything, pasted into a blank text file, renamed it Comments.php, then loaded it. So, hidden formatting should have been left behind, right? The error message remains the same.

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

I would start by just restoring those files from your download—refresh, make sure it still works (working in this case will be the original Spam module error). Then open the files in a plain text editor (Atom for instance), and apply the changes I referenced directly to the files that you can be sure have integrity.

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

That did it! Thank you so much. I tested the comments function, too, and it works. I appreciate your fast and thorough help!!!

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

My pleasure, and incidentally, this is also fixed in version 4.0.7 that was just released today, so when you update you will not have to maintain these changes yourself. Have a great weekend!

       
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.