Feature/help scout beacon#3229
Open
alexjpanagis wants to merge 1 commit into
Open
Conversation
Adds LLMS_Admin_Help_Beacon which renders a consent-gated HelpScout beacon on the LifterLMS admin screens. - Shown on the core LifterLMS menu pages (Dashboard, Settings, Reporting, Import, Status, Resources, Add-ons) and on the screens under the Courses, Memberships, Engagements, and Orders menus, including nested post types such as achievements, certificates, emails, coupons, and vouchers. Not shown on the Courses/Memberships block editors or the Course Builder. - Shows the support beacon on licensed sites and the pre-sales beacon otherwise; both filterable. - Pre-fills the current user's name and email into the beacon form. - Attaches the LifterLMS system report to both beacons as agent-only session data, kept out of the customer's message box. - The beacon script is only loaded after the user confirms a consent prompt, so no third-party script or cookie loads until opt-in.
816f429 to
aa26ba4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an in-dashboard HelpScout help beacon so users can reach documentation and support (or pre-sales) without leaving wp-admin.
The entire feature lives in a new self-instantiating admin class,
LLMS_Admin_Help_Beacon(following theLLMS_Admin_Reviewpattern), plus a one-linerequire_oncein the loader and a changelog entry. Three files:includes/admin/class-llms-admin-help-beacon.php(new)toplevel_page_lifterlms,lifterlms_page_llms-{dashboard,settings,reporting,import,status,resources,add-ons}). Intentionally excluded from the post editors and Course Builder so it never clutters the editing UI. Filter:llms_help_beacon_screens.is_licensed()checks the bundled helper (llms_helper_options()->get_license_keys(), guarded byfunction_exists). Filters:llms_help_beacon_is_licensed,llms_help_beacon_id. Beacon IDs are class constants..llms-button-primary); the HelpScout script is injected only after the user confirms aconfirm()prompt, so no third-party script or cookie loads until opt-in.Beacon('prefill', …).get_session_data()reusesLLMS_Data::get_data('system_report')and maps each top-level section to a HelpScoutsession-dataattribute, bounded to the API's 20-key / 10,000-char limits. This appears in the agent's conversation view, not the customer's message box. Filter:llms_help_beacon_session_data(return[]to disable).llms()->assets->enqueue_inline()system; dynamic data encoded withwp_json_encode( …, JSON_HEX_TAG | JSON_HEX_AMP ).includes/class-llms-loader.php—require_oncethe new class inincludes_admin()and an@since [version]docblock note..changelogs/help-scout-beacon.yml— changelog entry (minor/added).All new hooks use the
llms_prefix, all new symbols use@since [version], and every change is additive and filterable — no public signatures changed and no build step (pure PHP inline output).How has this been tested?
Manually tested in a local environment (Local / WP 7.0 / PHP 8.2.29) with LifterLMS running from this branch, unlicensed and (pre-sales) install + adding a license to compare (video shared in Slack):
confirm()gate: no HelpScout script or cookie loads until the user clicks OK.crypto.randomUUID), so the admin must be served over HTTPS.add_filter( 'llms_help_beacon_is_licensed', '__return_true' ), which switches to the support beacon and firesBeacon('session-data', …)with the system report. Agent-side visibility was not verified locally (requires the support HelpScout account).php -lis clean on all three changed files.The PHPUnit suite and PHPCS were not run in this environment — please rely on CI for those (see checklist below).
Types of changes
New feature (non-breaking change which adds functionality).
Checklist:
npm run dev changelog add -- -iand follow theprompt. See also: https://github.com/gocodebox/lifterlms/blob/trunk/packages/dev/README.md#changelog-add -->composer run-script check-cs-errors-->