Skip to content

Conversation

@bogiii
Copy link
Contributor

@bogiii bogiii commented Mar 27, 2025

Resolves #7784

Proposed Changes

  • Introduces a central place for both BE and FE to properly manage the upsell link
  • Update Sensei Pro upgrade URL to handle WPCOM-hosted sites correctly
  • The logic recognizes if the hosting is WPCOM or other; based on it, builds the upsell URL

Testing Instructions

  • Checkout this branch and run the npm run build command
  • Make sure you have a business plan site on your WPCOM account
  • Upload and install the sensei-lms.zip file generated by the first step on Dotcom
  • Create a new course
  • Navigate through the Sensei plugin and check the upsell/upgrade button ("Get Sensei Pro")
  • Check if you are redirected to the https://wordpress.com/plugins/sensei-pro/{SITE_SLUG}

Some of the affected CTAs:
Screenshot 2025-03-31 at 17 12 00
Screenshot 2025-03-31 at 17 17 47
Screenshot 2025-03-31 at 18 09 57

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • Code is tested on the minimum supported PHP and WordPress versions

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Mar 27, 2025

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 7eeeb4b and trunk. Please review and confirm the following are correct before merging.

No changes detected in the current commit. But the comment was left so it is possible to check for the edit history.

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

@bogiii bogiii self-assigned this Mar 27, 2025
@bogiii bogiii added this to the 4.24.6 milestone Mar 27, 2025
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii requested a review from a team March 27, 2025 15:00
@bogiii bogiii marked this pull request as ready for review March 27, 2025 15:23
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii requested a review from Imran92 March 28, 2025 10:54
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii marked this pull request as draft March 31, 2025 12:38
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii force-pushed the fix/sensei-pro-upgrade-url branch from fb363a2 to 469d046 Compare March 31, 2025 16:13
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii
Copy link
Contributor Author

bogiii commented Mar 31, 2025

Hey @renatho, I've updated my approach and created a 'single source of truth' related to the upsell URL generation. It is consumed on both the FE and BE sides.

When you find some time, please take a look. Thanks!

@bogiii bogiii marked this pull request as ready for review March 31, 2025 16:40
@bogiii bogiii requested a review from renatho March 31, 2025 16:40
Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @bogiii!
The solution looks great! I just realized a few things and added in comments in the code.

@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii removed the request for review from Imran92 April 4, 2025 13:45
bogiii added 14 commits April 9, 2025 14:39
- Move upsell URL to global admin data via window.sensei_admin
- Create reusable getSenseiProUpsellUrl helper function
- Update course upgrade step to use global helper
Replace hardcoded URLs with calls to Sensei_Pro_Upsell::get_base_url() and
get_default_utm_params() across the codebase for better maintainability and
consistency. Updated files:

- class-sensei-home-task-pro-upsell.php
- class-sensei-course.php
- class-sensei-groups-landing-page.php
- class-sensei-lesson.php
- class-sensei-settings-api.php
- class-sensei-course-theme-template-selection.php
- class-email-list-table.php

Also added proper use statements for Sensei_Pro_Upsell and add_query_arg
functions where needed.
@bogiii bogiii force-pushed the fix/sensei-pro-upgrade-url branch from 91f1031 to 02ac51a Compare April 9, 2025 12:39
@github-actions
Copy link

github-actions bot commented Apr 9, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Apr 9, 2025

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii requested a review from m1r0 April 9, 2025 12:43
@github-actions
Copy link

github-actions bot commented Apr 9, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Apr 9, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

github-actions bot commented Apr 9, 2025

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 merged commit 05995bc into trunk Apr 10, 2025
22 checks passed
@m1r0 m1r0 deleted the fix/sensei-pro-upgrade-url branch April 10, 2025 13:45
@m1r0
Copy link
Member

m1r0 commented Apr 10, 2025

LTMG! Thanks for the updates, Bogi!

I'm merging it to start testing on WP 6.8.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Sensei Pro upsell links on Dotcom

7 participants