Skip to content

Read branding and badges from the new static branding API - #791

Draft
ilicfilip wants to merge 3 commits into
developfrom
filip/yolo-branding-api
Draft

ilicfilip wants to merge 3 commits into
developfrom
filip/yolo-branding-api

Conversation

@ilicfilip

@ilicfilip ilicfilip commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Branding moves off progressplanner.com to a static API built from the new ProgressPlanner/your-branding repo. It's served from branding.your.online on Bunny. The Cloudflare demo at yolo-branding.pages.dev is temporary.

  • New setting PROGRESS_PLANNER_BRANDING_SERVER_URL, default https://branding.your.online. PROGRESS_PLANNER_REMOTE_SERVER_ROOT_URL is unchanged and still serves lessons, challenges and onboarding.
  • classes/ui/class-branding.php fetches one resolved document per brand, /v1/brands/{id}.json. Every field and asset there already falls back to the defaults, and asset URLs carry a content hash. The logo and menu icon are URLs, so the /wp/v2/media/{id} lookups are gone.
  • Badges come from the document's badges map, through the new get_badge_url() / get_badge_urls(). The four places that built badge-svg URLs now use it: class-enqueue.php, prpl-badge.js, upgrade-tasks.php and sunset-certificate.php. The certificate still uses the default badges.
  • Unbranded sites (ID 0) read 0.json for badges only. Text, logo and widgets keep the plugin's built-in defaults, so they look exactly as before.
  • The branding cache drops from a week to a day. A failed fetch stays cached for 5 minutes, and badge lookups now respect that instead of retrying (fixed during review, with a regression test in test-class-branding-cache.php).

Behaviour changes

  • An unknown badge ID shows the existing placeholder. The old endpoint silently returned the Nov 2024 badge.
  • InMotion (6318) and EyHost (6306) have an empty submenu name. It now falls back to the menu name, where WordPress used to get an empty title.

Deployment

branding.your.online is live on Bunny. On 2026-09-29 all 14 JSON files there matched a fresh build of your-branding main, and all 182 asset URLs returned 200.

The progressplanner.com endpoints (pp-branding, badge-svg) stay as they are for plugin versions already installed.

Testing

Checked locally with define( 'PROGRESS_PLANNER_BRANDING_SERVER_URL', 'https://yolo-branding.pages.dev' );:

  • Unbranded dashboard: all 54 badge images load from the new API, the default menu and logo are unchanged, and no badge-svg URLs are left.
  • ?pp_branding_id=5159 (yourhosting):
    • Logo, menu name and icon, brand CSS, the Dutch widget title and the assistant name all show.
    • 55 of 55 badges load: 23 of the brand's own, 17 inherited.
  • ?pp_branding_id=6318 (InMotion): logo, "Boldi", and 55 of 55 badges.
  • Console: clean apart from an InvalidStateError: Transition was aborted on reload, which also happens on develop.
  • Checks: phpcs on the changed files, PHPStan, and eslint all pass.

🤖 Generated with Claude Code

Branding moves off progressplanner.com to a static API built from the
ProgressPlanner/yolo-branding repo. The plugin now fetches one resolved
document per brand (/v1/brands/{id}.json) from a new
PROGRESS_PLANNER_BRANDING_SERVER_URL (default https://branding.yolo.online);
PROGRESS_PLANNER_REMOTE_SERVER_ROOT_URL keeps serving lessons, challenges and
onboarding.

- Logo and menu icon are URLs in the document: no more /wp/v2/media lookups.
- Badges come from the document's badge map; unbranded sites read the
  defaults (0.json) for badges only and keep the built-in text defaults.
  An unknown badge shows the placeholder (the old endpoint returned the
  Nov 2024 badge).
- Branding cache drops from a week to a day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 34.61% 📉
Base Coverage 34.24%
Difference 📈 0.37%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

📊 File-level Coverage Changes (3 files)

📈 Coverage Improved

Class Before After Change
Progress_Planner\UI\Branding 30.77% 64.71% +33.94%

📉 Coverage Decreased

Class Before After Change
Progress_Planner\Base 51.59% 51.23% -0.36%
Progress_Planner\Admin\Enqueue 11.59% 11.54% -0.05%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

Comment thread classes/class-base.php Outdated
return \untrailingslashit(
\defined( 'PROGRESS_PLANNER_BRANDING_SERVER_URL' )
? \constant( 'PROGRESS_PLANNER_BRANDING_SERVER_URL' )
: 'https://branding.yolo.online'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might become branding.your.online - let's verify before merging.

Comment thread classes/class-base.php Outdated
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.

2 participants