Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in initMarketingInfo - determineCountry Setting Not Working #1204

Open
steffenf14 opened this issue Jan 14, 2025 · 0 comments
Open

Bug in initMarketingInfo - determineCountry Setting Not Working #1204

steffenf14 opened this issue Jan 14, 2025 · 0 comments

Comments

@steffenf14
Copy link

I encountered an issue when trying to use the plugin.tx_powermail.settings.settings.setup.marketing.determineCountry = 1 setting to enable country information for my requests. Unfortunately, the feature doesn't work as intended, and after some debugging, I identified the root cause.

Steps to Reproduce:

  • Add the configuration plugin.tx_powermail.settings.settings.setup.marketing.determineCountry = 1 to enable the country detection.
  • Submit a form and check the marketing information stored in the database.
  • Notice that the country field is never populated with data from ip-api.com.

Findings:
The function initMarketingInfo (responsible for populating country information using ip-api.com) will never work as expected due to the following reasons:

  • The $settings array is always empty when initMarketingInfo is called.
    • This happens because initMarketingInfo is only called indirectly via the createAction method, and the createAction does not pass any settings down the call chain.
    • The call sequence is:
      createAction -> saveMail -> prepareMailForPersistence -> getMarketingInfos -> initMarketingInfo
      Since getMarketingInfos does not receive any arguments, it calls initMarketingInfo without arguments.
  • As a result, the isset($settings['setup']['marketing']['determineCountry']) condition always fails, and the fallback message "Country From IP is disabled." is used.

Additional:

The fallback message "Country From IP is disabled." (or its localized equivalent) is stored in the database in the frontend context language.
For instance, if a contact request is submitted in German, the message "Länderermittlung von IP Adresse ist deaktiviert." is saved to the database. This can confuse editors who expect a consistent language in backend data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants