Skip to content

Update pro tips and support sale api#2340

Merged
Crabcyborg merged 7 commits into
masterfrom
update_pro_tips_and_support_sale_api
May 1, 2025
Merged

Update pro tips and support sale api#2340
Crabcyborg merged 7 commits into
masterfrom
update_pro_tips_and_support_sale_api

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2025

Warning

Rate limit exceeded

@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c47c81b and e25d1fa.

📒 Files selected for processing (1)
  • classes/views/frm-settings/license_box.php (2 hunks)

Walkthrough

This change centralizes and standardizes the addition of UTM parameters to upgrade and promotional links throughout the application. A new helper method, maybe_add_missing_utm, is introduced in FrmAppHelper to append missing UTM parameters to URLs. Multiple controllers, helpers, and view templates are updated to utilize this method, ensuring consistent UTM parameter tagging for upgrade and CTA links. Additionally, the logic for generating tip links and labels is refactored in FrmTipsHelper, consolidating link construction and promotional text retrieval. No public API signatures are changed; all modifications are internal to existing classes and methods.

Changes

File(s) Change Summary
classes/helpers/FrmAppHelper.php Added new public static method maybe_add_missing_utm to append missing UTM parameters to URLs. Updated print_admin_banner to use this method for upgrade links, centralizing UTM handling.
classes/controllers/FrmAppController.php Updated internal logic in settings_link and admin_init methods to use the new UTM parameter handling: links are passed through maybe_add_missing_utm if present, or fallback links are generated with UTM parameters if not.
classes/helpers/FrmDashboardHelper.php Refactored get_license_buttons to construct upgrade links using the new centralized UTM parameter logic, ensuring consistent UTM tagging.
classes/helpers/FrmTipsHelper.php Introduced private static method get_tip_link to centralize tip link construction and UTM augmentation. Enhanced cta_label to retrieve promotional CTA text if available. Updated multiple tip-returning methods to use the new label logic and revised some tip texts.
classes/views/dashboard/templates/pro-features-list.php Refactored upgrade link assignment to always apply UTM parameters using maybe_add_missing_utm, ensuring consistent tracking.
classes/views/frm-settings/license_box.php Updated upgrade link logic for license box buttons to use centralized UTM parameter handling, improving consistency and maintainability.
classes/views/shared/admin-footer-links.php Modified upgrade link generation to ensure UTM parameters are appended using the new helper method, standardizing tracking across footer links.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant FrmSalesApi
    participant FrmAppHelper

    Caller->>FrmSalesApi: get_best_sale_value('some_cta_link')
    alt Link exists
        Caller->>FrmAppHelper: maybe_add_missing_utm(link, utm_params)
        FrmAppHelper-->>Caller: Link with missing UTM params added
    else Link does not exist
        Caller->>FrmAppHelper: admin_upgrade_link(utm_params)
        FrmAppHelper-->>Caller: Default upgrade link with UTM params
    end
Loading

Possibly related PRs

  • Strategy11/formidable-forms#1997: Refactors upgrade link generation to include UTM content for better tracking, related by focus on UTM parameter handling in upgrade CTAs.
  • Strategy11/formidable-forms#2318: Adds banner display and dismissal functionality and adjusts control flow in print_admin_banner; related context but no direct overlap in UTM link handling.
  • Strategy11/formidable-forms#2205: Updates FrmAppController methods related to upgrade links, overlapping in concerns about upgrade link retrieval and handling.

Suggested labels

deploy

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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
Copy Markdown
Contributor

@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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 103509e and 5f12ae1.

📒 Files selected for processing (7)
  • classes/controllers/FrmAppController.php (2 hunks)
  • classes/helpers/FrmAppHelper.php (2 hunks)
  • classes/helpers/FrmDashboardHelper.php (1 hunks)
  • classes/helpers/FrmTipsHelper.php (13 hunks)
  • classes/views/dashboard/templates/pro-features-list.php (1 hunks)
  • classes/views/frm-settings/license_box.php (2 hunks)
  • classes/views/shared/admin-footer-links.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
classes/views/shared/admin-footer-links.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4568)
  • pro_is_installed (279-281)
classes/views/dashboard/templates/pro-features-list.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4568)
  • admin_upgrade_link (121-162)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: Cypress
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP trunk
🔇 Additional comments (12)
classes/helpers/FrmAppHelper.php (2)

164-190: Well-structured helper method for consistent UTM parameter handling.

This new method provides a centralized way to handle UTM parameters for promotional links. It checks if specific UTM parameters already exist in a URL and only adds missing ones, which prevents duplicate parameters while ensuring consistent tracking.


1462-1472: Good implementation of the new UTM parameter handling.

The refactored code in print_admin_banner organizes the UTM parameters in a separate array and uses the new maybe_add_missing_utm method to ensure upgrade links have consistent tracking parameters. This approach is more maintainable than directly embedding the parameters in each URL.

classes/views/shared/admin-footer-links.php (1)

10-21: Consistent approach to UTM parameter handling in footer links.

The code now clearly defines UTM parameters in a separate array and handles both existing and fallback link scenarios appropriately. This ensures all footer upgrade links have consistent tracking parameters regardless of their source.

classes/views/dashboard/templates/pro-features-list.php (1)

22-30: Improved UTM parameter handling for discount links.

The implementation follows the new pattern of defining UTM parameters separately and using the maybe_add_missing_utm helper method consistently. This standardizes tracking across promotional links in the dashboard.

classes/views/frm-settings/license_box.php (1)

12-20: Good implementation of the new UTM parameter handling pattern.

The approach of defining UTM parameters separately and checking for existing links before generating fallbacks keeps the code clean and consistent with other parts of the application.

classes/helpers/FrmDashboardHelper.php (1)

205-214: Standardized UTM parameter handling for upgrade links

This change improves the consistency of UTM tracking by centralizing the UTM parameter handling. When a sale link exists, it ensures parameters are properly added; otherwise, it falls back to the standard admin upgrade link.

classes/controllers/FrmAppController.php (2)

359-365: Improved upgrade link handling with standardized UTM tracking

The code now first checks if a custom upgrade link exists from the sales API, then enhances it with UTM parameters. This approach is more maintainable and ensures consistent tracking across promotional links.


582-588: Consistent upgrade link handling with UTM parameter tracking

This change follows the same pattern as the previous upgrade link modification. It separates the UTM parameters into a dedicated variable and uses a consistent approach to either enhance existing links or generate new ones with proper tracking parameters.

classes/helpers/FrmTipsHelper.php (4)

58-58: Refactored tip link generation for better maintainability

The code now delegates link generation to a dedicated method instead of inline logic, improving readability and maintainability.


79-99: Added helper method for centralized tip link generation

The new get_tip_link method standardizes how tip links are constructed, ensuring consistent UTM parameter tracking across all promotional tip links. This is a good refactoring that improves code organization and maintainability.


109-112: Enhanced CTA label customization

This improvement allows for dynamic promotional text from the sales API, providing more flexibility in marketing messaging without code changes.


134-135: Updated promotional messaging for consistency and clarity

Multiple tip descriptions have been refined for better clarity, engagement, and consistency. The promotional calls-to-action now use the centralized cta_label() method for unified messaging across the plugin.

Also applies to: 150-151, 166-167, 184-185, 192-193, 200-201, 218-219, 242-243, 250-251, 258-259, 274-275, 282-283, 290-291, 298-299, 316-317, 350-351, 366-367

Comment thread classes/views/frm-settings/license_box.php Outdated
Comment thread classes/views/frm-settings/license_box.php Outdated
Copy link
Copy Markdown
Contributor

@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

♻️ Duplicate comments (1)
classes/views/frm-settings/license_box.php (1)

38-52: ⚠️ Potential issue

Exact duplicate block still present – please remove to avoid conflicting values

This duplicate code was pointed out in the previous review but remains unchanged. Re-querying the same sale values and rebuilding the UTM parameters increases maintenance burden and can accidentally overwrite the variables set above.

- $unlock_more_upgrade_text = FrmSalesApi::get_best_sale_value( 'global_settings_unlock_more_cta_text' );
- if ( ! $unlock_more_upgrade_text ) {
-   $unlock_more_upgrade_text = __( 'upgrading to PRO', 'formidable' );
- }
-
- $unlock_more_upgrade_link = FrmSalesApi::get_best_sale_value( 'global_settings_unlock_more_cta_link' );
- $utm                      = array(
-   'medium'  => 'settings-license',
-   'content' => 'global-settings-license-box-unlock-more',
- );
- if ( $unlock_more_upgrade_link ) {
-   $unlock_more_upgrade_link = FrmAppHelper::maybe_add_missing_utm( $unlock_more_upgrade_link, $utm );
- } else {
-   $unlock_more_upgrade_link = FrmAppHelper::admin_upgrade_link( $utm );
- }

After removal, the first block (27-36) will supply the $unlock_more_upgrade_text and $unlock_more_upgrade_link values exactly once.

🧹 Nitpick comments (1)
classes/views/frm-settings/license_box.php (1)

27-36: Potential variable shadowing & unnecessary recomputation

$utm is re-declared a second time a few lines later (38-47). Although PHP allows this, the second declaration is redundant and makes the intent harder to follow. Consider defining the array only once per logical block (button vs unlock-more) to avoid confusion.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5f12ae1 and 1acdc87.

📒 Files selected for processing (1)
  • classes/views/frm-settings/license_box.php (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (1)
classes/views/frm-settings/license_box.php (1)

12-20: Nice consolidation of UTM handling for the “Get Formidable Now” link

Using a single $utm array and maybe_add_missing_utm() keeps the link-building logic DRY and consistent with the new helper.

@Crabcyborg Crabcyborg merged commit aa58a96 into master May 1, 2025
15 of 16 checks passed
@Crabcyborg Crabcyborg deleted the update_pro_tips_and_support_sale_api branch May 1, 2025 00:18
@coderabbitai coderabbitai Bot mentioned this pull request Oct 10, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Oct 27, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant