Skip to content

gppa-disable-gfml-pre-render-callback.php: Fixed an issue with snippet not working for newer versions of GPML. #1127

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saifsultanc
Copy link
Contributor

@saifsultanc saifsultanc commented Jun 30, 2025

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2975924505/85517

Summary

The value modifier of a merge tag doesn't work when WPML String translations is activated, even when using this snippet.

It seems we need to also target gform_merge_tag_filter in the disable logic, probably applicable for the newer versions of GFML.

BEFORE:
Screenshot 2025-06-30 at 3 34 05 PM

AFTER:
Screenshot 2025-06-30 at 3 33 46 PM

…pet not working for newer versions of GPML.
Copy link

coderabbitai bot commented Jun 30, 2025

Walkthrough

The code update enhances the disabling of Gravity Forms Multilingual (GFML) callbacks during a specific AJAX operation for Populate Anything batch field HTML. It now removes both the 'gform_pre_render' and 'gform_merge_tag_filter' callbacks from the GFML API object to prevent GFML from affecting merge tag processing for designated form IDs.

Changes

File(s) Change Summary
gp-populate-anything/gppa-disable-gfml-pre-render-callback.php Now removes both 'gform_pre_render' and 'gform_merge_tag_filter' callbacks during specific AJAX calls

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AJAX Handler
    participant GFML API

    User->>AJAX Handler: Initiate Populate Anything batch field HTML request
    AJAX Handler->>GFML API: Remove 'gform_pre_render' callback
    AJAX Handler->>GFML API: Remove 'gform_merge_tag_filter' callback
    AJAX Handler->>AJAX Handler: Process AJAX operation without GFML interference
    AJAX Handler-->>User: Return processed HTML
Loading

Possibly related PRs

Suggested reviewers

  • veryspry

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 phpcs (3.7.2)
gp-populate-anything/gppa-disable-gfml-pre-render-callback.php

Warning: PHP Startup: Invalid date.timezone value 'UTC', using 'UTC' instead in Unknown on line 0

Fatal error: Uncaught Error: Class "Phar" not found in /usr/local/bin/phpcs:3
Stack trace:
#0 {main}
thrown in /usr/local/bin/phpcs on line 3

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Warnings
⚠️ When ready, don't forget to request reviews on this pull request from your fellow wizards.

Generated by 🚫 dangerJS against ffa0908

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
gp-populate-anything/gppa-disable-gfml-pre-render-callback.php (1)

3-9: Update documentation to reflect the additional filter removal.

The file header comment mentions only the 'gform_pre_render' callback, but now the snippet also removes the 'gform_merge_tag_filter' callback. Consider updating the title and description to reflect this broader functionality.

-/**
- * Gravity Perks // Populate Anything // Disable GFML gform_pre_render callback
- * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
- *
- * Bypass processing forms with Gravity Forms Multilingual when pulling results for Populate Anything via AJAX.
- *
- * The reason for this is due to the 'gform_pre_render' method in Gravity_Forms_Multilingual using a runtime cache to
- * cache all forms which interferes with Populate Anything.
+/**
+ * Gravity Perks // Populate Anything // Disable GFML callbacks
+ * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
+ *
+ * Bypass processing forms with Gravity Forms Multilingual when pulling results for Populate Anything via AJAX.
+ *
+ * The reason for this is due to GFML callbacks ('gform_pre_render' and 'gform_merge_tag_filter') interfering 
+ * with Populate Anything functionality, including merge tag value modifiers when WPML String translations is activated.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24c21fd and ffa0908.

📒 Files selected for processing (1)
  • gp-populate-anything/gppa-disable-gfml-pre-render-callback.php (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: veryspry
PR: gravitywiz/snippet-library#1077
File: gravity-forms/gw-require-alt-text-description-post-image.php:23-32
Timestamp: 2025-05-30T13:53:21.893Z
Learning: In Gravity Forms snippets, use 'gravityforms' as the translation domain for internationalization functions instead of creating custom domains, to maintain consistency with the related plugin.
gp-populate-anything/gppa-disable-gfml-pre-render-callback.php (1)
Learnt from: veryspry
PR: gravitywiz/snippet-library#1077
File: gravity-forms/gw-require-alt-text-description-post-image.php:23-32
Timestamp: 2025-05-30T13:53:21.893Z
Learning: In Gravity Forms snippets, use 'gravityforms' as the translation domain for internationalization functions instead of creating custom domains, to maintain consistency with the related plugin.
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Danger JS
  • GitHub Check: Danger JS
🔇 Additional comments (1)
gp-populate-anything/gppa-disable-gfml-pre-render-callback.php (1)

39-39: LGTM! The additional filter removal directly addresses the merge tag issue.

The addition of removing the 'gform_merge_tag_filter' callback follows the same pattern as the existing code and directly addresses the issue described in the PR where merge tag value modifiers fail with WPML String translations activated.

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

Successfully merging this pull request may close these issues.

1 participant