Your software
My Mautic version is: 3.1.0
My PHP version is: 7.3.20
My MariaDB version is : 10.5
Your problem
My problem is: when submitting a form to subscribe to my mailing list, everything works but the action " Remove contact from do not contact list".
So if a contact was set to “Do not contact” and people submit the form to subscribe they stay in the state “Do not contact”.
These errors are showing in the log:
no errors are shown in the logs
Steps I have tried to fix the problem:
I enabled debugging by adding ‘debug’ => true, in local.php but no useful debug info was printed out in the log file
How to reproduce the problem:
It’s easy:
have a test contact to unsubscribe using a unsubscribe link in an email
make a form to subscribe having the action " Remove contact from do not contact list" and use it in a landing page
go to the landing page to subscribe again with the test contact’s email address
check if the contact is still in “Do not contact” state
I tried to do something on the Contact Preference Center: I just ticked the checkbox for Email and then pressed save (there’s nothing more I can do: all the fields for the Frequency settings are greyed out)
When pressing save I have an error 500
Corresponding to this log line:
mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "removeDncForLead" of class "Mautic\LeadBundle\Model\LeadModel"." at /var/www/mmm.mysite.com/app/bundles/LeadBundle/Controller/FrequencyRuleTrait.php line 180 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedMethodException(code: 0): Attempted to call an undefined method named \"removeDncForLead\" of class \"Mautic\\LeadBundle\\Model\\LeadModel\". at /var/www/mmm.mysite.com/app/bundles/LeadBundle/Controller/FrequencyRuleTrait.php:180)"} []
Why would I have an undefined method named "removeDncForLead" ?
I looked at that line 180 in FrequencyRuleTrait.php: $leadModel->removeDncForLead($lead, $contactChannel);
Then I looked into app/bundles/LeadBundle/Model/LeadModel.php but didn’t find any definition of removeDncForLead. I stopped there…