Jump to content
thirty bees forum

How to completely disable the contact form


cprats

Recommended Posts

I've removed the "contact us" page entry from Preferences -> Seo & URLs, but it is still accessible through the sitemap, in the adress mysite.com/index.php?controller=contact.

Is there any way to disable also this "index.php?controller=contact"?

I just get spam from there.

Link to comment
Share on other sites

As I said - use one of the recaptcha modules - the one of TB also has recaptch on all forms, including BO so this can be one more level of protection for your BO. There's also one free PS module which is compatible but it only covers the contact form.

You will exerience a rapid decline of your spam... :) (to be read as zero spam)... nobody will manually spam with your site be sure in that...

Link to comment
Share on other sites

  • 3 years later...

I am resurrecting this thread because I also would like to completely disable the contact form.

I do not want to utilize a captcha to reduce spam but I want the contact form functionality gone from thirty bees.

For security reasons I completely separate receiving emails from customers and thirty bees. I do not use the customer service features in the backoffice and exclusively communicate with the customers via email hosted on another machine. It also is my understanding that nobody actually likes nor trusts contact forms.

I googled and found this page on stackoverflow, this "small module" solution is used in prestashop 1.6 and I have tried it however thirty bees will not see the module and I can't even get to the point of installing it.

Quote

Create a new directory contactpagedisabler in folder modules and inside create a file contactpagedisabler.php and put this code in and then install this module from backoffice.

<?php
class ContactPageDisabler extends Module 
{
    public function __construct() 
    {
        $this->name = 'contactpagedisabler';
        $this->tab = 'front_office_features';
        $this->version = '1.0';
        $this->author = 'whatever';

        parent::__construct();

        $this->displayName = $this->l('Contact page disabler');
        $this->description = $this->l('Disables contact page.');
    }

    public function install() 
    {
        return parent::install() && $this->registerHook('actionDispatcher');
    }

    // hook runs just after controller has been instantiated
    public function hookActionDispatcher($params) 
    {
        if ($params['controller_type'] === 1 && $params['controller_class'] === 'ContactController') {
            Tools::redirect('pagenotfound'); // redirect contact page to 404 page
        }
    }
}

This is not working, I can't figure out how

I could rename the file controllers/front/ContactController.php to controllers/front/ContactController.php.disabled and it would take it down, however that counts as modifying core files and it is not recommended to maintain changes across updates. How do I achieve the same outcome in a safer way / preserving core files?

Update 26-01-2022:

Currently utilizing an override to redirect the page defined in controllers/front/ContactController.php to error 404: I have created the file override/controllers/front/ContactController.php containing the following code, then deleting the /cache/class_index.php file to clear the cache.

<?php
// The override file must contain the class named ContactController 
// which must extend the class ContactControllerCore 
// defined in controllers/front/ContactController.php
class ContactController extends ContactControllerCore {
    public function init(){ // where is this function defined?
        Tools::redirect('pagenotfound'); // redirect contact page to 404 page
    }
}

The documentation says this regarding overrides:

Quote

In order to override the Product class, your file needs to be called Product.php and must feature a Product class that then extends ProductCore class.

The file can be placed in either of these locations:

/override/classes/Product.php
/modules/my_module/override/classes/Product.php

In order to override the ProductController class, your file needs to be called ProductController.php and must feature a ProductController class that then extends ProductControllerCore class.

The file can be placed in either of these locations:

/override/controllers/front/ProductController.php

/modules/my_module/override/controllers/front/ProductController.php

However, I have no idea what the public function init() exactly does.

My concern is that bots and users with bad intentions could access the contact form and manage to send emails through my server through it, compromising the reputation of my domain name and IP address. Such an incident has been reported on this forum before, though it was mitigated with a captcha.

Do you believe my solution will be able to completely prevent anybody from accessing the contact form?

Edited by Jeffrey de Bruijn
Solution? Maybe?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...