Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • W WordPress
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • WordPress
  • Issues
  • #101
Closed
Open
Created Jun 01, 2021 by Francis (Agileware)@agilewarefjDeveloper

CiviCRM internal AJAX path ( q=civicrm/ajax/* ) should set wp_doing_ajax - Gravity Forms 2.5.3+ breaks Mailings

CiviCRM version: 5.37.2

Today ran into an issue on a few client sites where a Gravity Forms update to version 2.5.3+ would cause Mailings to not be loaded.

The cause for this was that a new filter in Gravity Forms would inject a <script> tag immediately after the <head> tag that appears in the body_html JSON field from Mailing.getSingle API calls, with no escaping - which then breaks the JSON parser. Note that this uses the internal civicrm/ajax path and thus doesn't go through the WP Rest interface.

Gravity Forms checks the DOING_AJAX constant before performing this injection, so the workaround was to add a hook_civicrm_config implementation that would define('DOING_AJAX', true) if the q parameter starts with civicrm/ajax

Would be preferable if this was done something during the initialisation of the CiviCRM WordPress plugin itself, for both admin and front-end paths.

There is a filter wp_doing_ajax, which defaults to DOING_AJAX, however it's worth noting that Gravity Forms does not use the interface to this filter, but the DOING_AJAX constant itself, so in this case it would be better to define DOING_AJAX as well.

Edited Jun 01, 2021 by Francis (Agileware)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking