Skip to content

Commit 01a2046

Browse files
committed
Merge branch 'trunk' into feat/integration-oauth-field-type
2 parents 1409569 + d1009c0 commit 01a2046

41 files changed

Lines changed: 7063 additions & 1164 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [6.39.3](https://github.com/Automattic/newspack-plugin/compare/v6.39.2...v6.39.3) (2026-05-11)
2+
3+
4+
### Bug Fixes
5+
6+
* add spce above 'save' button in ad settings ([#4710](https://github.com/Automattic/newspack-plugin/issues/4710)) ([01bcd34](https://github.com/Automattic/newspack-plugin/commit/01bcd343fe2e828d2b992ab94cd017ae780b9694))
7+
18
## [6.39.2](https://github.com/Automattic/newspack-plugin/compare/v6.39.1...v6.39.2) (2026-05-07)
29

310

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"require": {
1111
"composer/installers": "~2.0",
12-
"joshtronic/php-loremipsum": "^2.1",
1312
"google/auth": "^1.15",
1413
"woocommerce/action-scheduler": "^3.9"
1514
},

composer.lock

Lines changed: 5 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/class-newspack-ui-icons.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ public static function sanitize_svgs() {
127127
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--collections">
128128
<path d="M5.5 17.0009V18.5009H7.5V17.0009H5.5ZM5.5 20.0009C4.67188 20.0009 4 19.329 4 18.5009V17.0009V16.2509V15.5009V8.50092V7.75092V7.00092V5.50092C4 4.6728 4.67188 4.00092 5.5 4.00092C7.33333 4.00092 9.16667 4.00092 11 4.00092C11.6438 4.00092 12.1906 4.40405 12.4062 4.9728C12.5813 4.78217 12.8094 4.63842 13.075 4.56655L14.9344 4.05092C15.7063 3.83842 16.5 4.3103 16.7063 5.10717L17.2688 7.26967L17.4563 7.99467L19.3875 15.4415L19.575 16.1665L19.9469 17.604C20.1531 18.4009 19.6969 19.2197 18.925 19.4322L17.0625 19.9478C16.2906 20.1603 15.4969 19.6884 15.2906 18.8915L14.7281 16.729L14.5406 16.004L12.6125 8.5603L12.5 8.13217V8.50092V15.5009V16.2509V17.0009V18.5009C12.5 19.329 11.8281 20.0009 11 20.0009C9.08318 20.0009 7.41682 20.0009 5.5 20.0009ZM9 18.5009H11V17.0009H9V18.5009ZM7.5 5.50092H5.5V7.00092H7.5V5.50092ZM7.5 8.50092H5.5V15.5009H7.5V8.50092ZM9 7.00092H11V5.50092H9V7.00092ZM11 15.5009V8.50092H9V15.5009H11ZM17.7531 15.1165L16.0094 8.3978L14.2437 8.8853L15.9875 15.604L17.7531 15.1165ZM16.3656 17.0572L16.7375 18.4853L18.5 17.9978C18.5 17.9947 18.5 17.9915 18.5 17.9884V17.9853L18.1344 16.5728L16.3687 17.0603L16.3656 17.0572ZM13.8687 7.43217L15.6344 6.94467L15.2625 5.51655L13.5 6.00405C13.5 6.00717 13.5 6.0103 13.5 6.01655L13.8656 7.42905L13.8687 7.43217Z" />
129129
</svg>',
130+
'copy' =>
131+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--copy">
132+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" />
133+
</svg>',
130134
'curatedList' =>
131135
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--curated-list">
132136
<path d="M5.5 7.5H7.5V9.5H5.5V7.5ZM5.5 13.5H7.5V11.5H5.5V13.5ZM8.5 9.5H15.5V7.5H8.5V9.5ZM8.5 13.5H15.5V11.5H8.5V13.5ZM16.375 18H4.625C4.19402 18 3.7807 17.8288 3.47595 17.524C3.1712 17.2193 3 16.806 3 16.375V4.625C3 3.728 3.728 3 4.625 3H16.375C17.273 3 18 3.728 18 4.625V16.375C18 17.273 17.273 18 16.375 18ZM4.625 16.5H16.375C16.4082 16.5 16.4399 16.4868 16.4634 16.4634C16.4868 16.4399 16.5 16.4082 16.5 16.375V4.625C16.5 4.59185 16.4868 4.56005 16.4634 4.53661C16.4399 4.51317 16.4082 4.5 16.375 4.5H4.625C4.59185 4.5 4.56005 4.51317 4.53661 4.53661C4.51317 4.56005 4.5 4.59185 4.5 4.625V16.375C4.5 16.444 4.556 16.5 4.625 16.5ZM20.25 19C20.25 19.69 19.69 20.25 19.001 20.25H6V21.75H19.001C19.3621 21.75 19.7196 21.6789 20.0532 21.5406C20.3868 21.4024 20.6899 21.1999 20.9452 20.9445C21.2005 20.6891 21.4029 20.3859 21.541 20.0523C21.6791 19.7187 21.7501 19.3611 21.75 19V8H20.25V19Z" />
@@ -147,6 +151,10 @@ public static function sanitize_svgs() {
147151
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--error">
148152
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" />
149153
</svg>',
154+
'gift' =>
155+
'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--gift">
156+
<path d="M17.25 6.5C17.25 5.83696 16.9866 5.20107 16.5178 4.73223C16.0489 4.26339 15.413 4 14.75 4C14.087 4 13.4511 4.26339 12.9822 4.73223C12.5134 5.20107 12.25 5.83696 12.25 6.5C12.25 5.83696 11.9866 5.20107 11.5178 4.73223C11.0489 4.26339 10.413 4 9.75 4C9.08696 4 8.45107 4.26339 7.98223 4.73223C7.51339 5.20107 7.25 5.83696 7.25 6.5C7.25 7.16304 7.51339 7.79893 7.98223 8.26777C8.45107 8.73661 9.08696 9 9.75 9H4V20H20V9H14.75C15.413 9 16.0489 8.73661 16.5178 8.26777C16.9866 7.79893 17.25 7.16304 17.25 6.5ZM8.75 6.5C8.75 5.95 9.2 5.5 9.75 5.5C10.3 5.5 10.75 5.95 10.75 6.5V7.5H9.75C9.2 7.5 8.75 7.05 8.75 6.5ZM11.5 18.5H5.5V10.5H11.5V18.5ZM13.75 6.5C13.75 5.95 14.2 5.5 14.75 5.5C15.3 5.5 15.75 5.95 15.75 6.5C15.75 7.05 15.3 7.5 14.75 7.5H13.75V6.5ZM18.5 10.5V18.5H13V10.5H18.5Z" fill="#1E1E1E"/>
157+
</svg>',
150158
'globe' =>
151159
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--globe">
152160
<path d="M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" />
@@ -194,9 +202,5 @@ public static function sanitize_svgs() {
194202
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--trash">
195203
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />
196204
</svg>',
197-
'gift' =>
198-
'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--gift">
199-
<path d="M17.25 6.5C17.25 5.83696 16.9866 5.20107 16.5178 4.73223C16.0489 4.26339 15.413 4 14.75 4C14.087 4 13.4511 4.26339 12.9822 4.73223C12.5134 5.20107 12.25 5.83696 12.25 6.5C12.25 5.83696 11.9866 5.20107 11.5178 4.73223C11.0489 4.26339 10.413 4 9.75 4C9.08696 4 8.45107 4.26339 7.98223 4.73223C7.51339 5.20107 7.25 5.83696 7.25 6.5C7.25 7.16304 7.51339 7.79893 7.98223 8.26777C8.45107 8.73661 9.08696 9 9.75 9H4V20H20V9H14.75C15.413 9 16.0489 8.73661 16.5178 8.26777C16.9866 7.79893 17.25 7.16304 17.25 6.5ZM8.75 6.5C8.75 5.95 9.2 5.5 9.75 5.5C10.3 5.5 10.75 5.95 10.75 6.5V7.5H9.75C9.2 7.5 8.75 7.05 8.75 6.5ZM11.5 18.5H5.5V10.5H11.5V18.5ZM13.75 6.5C13.75 5.95 14.2 5.5 14.75 5.5C15.3 5.5 15.75 5.95 15.75 6.5C15.75 7.05 15.3 7.5 14.75 7.5H13.75V6.5ZM18.5 10.5V18.5H13V10.5H18.5Z" fill="#1E1E1E"/>
200-
</svg>',
201205
);
202206
}

includes/class-newspack.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ private function includes() {
218218
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-gravityforms.php';
219219
include_once NEWSPACK_ABSPATH . 'includes/plugins/google-site-kit/class-googlesitekit.php';
220220
include_once NEWSPACK_ABSPATH . 'includes/plugins/google-site-kit/class-googlesitekit-logger.php';
221+
include_once NEWSPACK_ABSPATH . 'includes/plugins/google-site-kit/class-ga4-custom-dimensions.php';
221222
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-mailchimp-for-woocommerce.php';
222223
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-onesignal.php';
223224
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-organic-profile-block.php';
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
/**
3+
* WP-CLI commands for GA4 custom dimension provisioning.
4+
*
5+
* @package Newspack
6+
*/
7+
8+
namespace Newspack\CLI;
9+
10+
use Newspack\GA4_Custom_Dimensions;
11+
use WP_CLI;
12+
13+
defined( 'ABSPATH' ) || exit;
14+
15+
/**
16+
* Provisions Newspack's standard GA4 custom dimensions.
17+
*/
18+
class GA4_Dimensions {
19+
20+
/**
21+
* Provision Newspack's GA4 custom dimensions on the connected property.
22+
*
23+
* Authenticates via Newspack's Google OAuth (preferred – its tokens carry
24+
* the `analytics.edit` scope) and falls back to Google Site Kit. Without an
25+
* explicit `--user`, it authenticates as the Site Kit module owner, so the
26+
* command works unattended from cron; pass `--user=<admin>` to run as a
27+
* specific administrator instead. Exits non-zero if any dimension could not
28+
* be created.
29+
*
30+
* ## OPTIONS
31+
*
32+
* [--dry-run]
33+
* : Report connection status and available slots without creating anything.
34+
*
35+
* ## EXAMPLES
36+
*
37+
* wp newspack ga4-dimensions provision
38+
* wp newspack ga4-dimensions provision --dry-run
39+
* wp --user=admin newspack ga4-dimensions provision
40+
*
41+
* @param array $args Positional args.
42+
* @param array $assoc_args Flags.
43+
*/
44+
public function provision( $args, $assoc_args ) {
45+
$dry_run = ! empty( $assoc_args['dry-run'] );
46+
47+
if ( $dry_run ) {
48+
$status = GA4_Custom_Dimensions::status();
49+
if ( is_wp_error( $status ) ) {
50+
WP_CLI::error( $status->get_error_message() );
51+
}
52+
WP_CLI::log( 'GA4 dimension provisioning status:' );
53+
WP_CLI::log( sprintf( ' Property ID: %s', $status['property_id'] ) );
54+
WP_CLI::log( sprintf( ' Site Kit connected: %s', $status['site_kit_connected'] ? 'yes' : 'no' ) );
55+
WP_CLI::log( sprintf( ' Auth source: %s', $status['auth_source'] ?? 'unknown' ) );
56+
WP_CLI::log( sprintf( ' Event-scoped existing: %d', $status['event_scoped_existing'] ) );
57+
WP_CLI::log( sprintf( ' Newspack dimensions: %d total, %d present, %d missing', $status['newspack_total'], count( $status['newspack_present'] ), count( $status['newspack_missing'] ) ) );
58+
if ( $status['newspack_missing'] ) {
59+
WP_CLI::log( ' Missing: ' . implode( ', ', $status['newspack_missing'] ) );
60+
}
61+
return;
62+
}
63+
64+
$result = GA4_Custom_Dimensions::provision();
65+
if ( is_wp_error( $result ) ) {
66+
WP_CLI::error( $result->get_error_message() );
67+
}
68+
GA4_Custom_Dimensions::maybe_schedule_recheck();
69+
WP_CLI::log( sprintf( 'Property ID: %s', $result['property_id'] ) );
70+
WP_CLI::log( sprintf( 'Auth source: %s', $result['auth_source'] ?? 'unknown' ) );
71+
WP_CLI::log( sprintf( 'Created: %d (%s)', count( $result['created'] ), implode( ', ', $result['created'] ) ) );
72+
WP_CLI::log( sprintf( 'Already existed: %d', count( $result['skipped_exists'] ) ) );
73+
if ( ! empty( $result['errors'] ) ) {
74+
WP_CLI::warning( 'Errors:' );
75+
foreach ( $result['errors'] as $name => $message ) {
76+
WP_CLI::log( " $name: $message" );
77+
}
78+
WP_CLI::error( sprintf( '%d dimension(s) could not be created.', count( $result['errors'] ) ) );
79+
}
80+
WP_CLI::success( 'GA4 dimension provisioning complete.' );
81+
}
82+
}

includes/cli/class-initializer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public static function init() {
2929
include_once NEWSPACK_ABSPATH . 'includes/cli/class-mailchimp.php';
3030
include_once NEWSPACK_ABSPATH . 'includes/cli/class-optional-modules.php';
3131
include_once NEWSPACK_ABSPATH . 'includes/cli/class-woocommerce-subscriptions.php';
32+
include_once NEWSPACK_ABSPATH . 'includes/cli/class-ga4-dimensions.php';
33+
include_once NEWSPACK_ABSPATH . 'includes/cli/class-teams-for-memberships-diagnostics.php';
3234
}
3335

3436
/**
@@ -78,6 +80,16 @@ public static function register_comands() {
7880
WP_CLI::add_command( 'newspack migrate-co-authors-guest-authors', [ 'Newspack\CLI\Co_Authors_Plus', 'migrate_guest_authors' ] );
7981
WP_CLI::add_command( 'newspack backfill-non-editing-contributors', [ 'Newspack\CLI\Co_Authors_Plus', 'backfill_non_editing_contributor' ] );
8082
WP_CLI::add_command( 'newspack migrate-expired-subscriptions', [ 'Newspack\CLI\WooCommerce_Subscriptions', 'migrate_expired_subscriptions' ] );
83+
WP_CLI::add_command( 'newspack ga4-dimensions', 'Newspack\CLI\GA4_Dimensions' );
84+
85+
// Only register the Teams for Memberships diagnostics command on sites where the
86+
// SkyVerge plugin is active. No reason to surface it in `wp help` otherwise.
87+
if ( class_exists( 'WC_Memberships_For_Teams_Loader' ) ) {
88+
WP_CLI::add_command(
89+
'newspack teams-for-memberships diagnostics',
90+
[ 'Newspack\CLI\Teams_For_Memberships_Diagnostics', 'diagnostics' ]
91+
);
92+
}
8193

8294
Optional_Modules::register_commands();
8395
}

0 commit comments

Comments
 (0)