PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.4
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.4
3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 All 197 releases
← All changes | includes/blocks/class-convertkit-block-content.php +32 -6 3.3.73.4.4 View file →
@@ -37,8 +37,9 @@
37 37
38 38 /**
39 39 * This will register as:
40 40 * - a shortcode, with the name [convertkit_content]
41 + * - a shortcode, with the name [kit_content]
41 42 * - a Gutenberg block, with the name convertkit/content
42 43 */
43 44 return 'content';
44 45
@@ -253,17 +254,42 @@
253 254 'output_content'
254 255 );
255 256
256 257 // Get the subscriber's tags, to see if they subscribed to this tag.
257 - $tags = $api->get_subscriber_tags( $subscriber_id );
258 + if ( is_numeric( $subscriber_id ) ) {
259 + $tags = $api->get_subscriber_tags( $subscriber_id );
258 260
259 - // Bail if an error occurred.
260 - if ( is_wp_error( $tags ) ) {
261 - if ( $settings->debug_enabled() ) {
262 - return '<!-- Kit Custom Content: ' . $tags->get_error_message() . ' -->';
261 + // Bail if an error occurred.
262 + if ( is_wp_error( $tags ) ) {
263 + if ( $settings->debug_enabled() ) {
264 + return '<!-- Kit Custom Content: ' . $tags->get_error_message() . ' -->';
265 + }
266 +
267 + return '';
263 268 }
269 + } else {
270 + // Subscriber ID is a signed subscriber ID.
271 + // Get tags that the subscriber has access to via the profile() method.
272 + $result = $api->profile( $subscriber_id );
264 273
265 - return '';
274 + // If an error occurred, the subscriber ID is invalid.
275 + if ( is_wp_error( $result ) ) {
276 + if ( $settings->debug_enabled() ) {
277 + return '<!-- Kit Custom Content: ' . $result->get_error_message() . ' -->';
278 + }
279 +
280 + return '';
281 + }
282 +
283 + // Build tags array.
284 + $tags = array(
285 + 'tags' => array(),
286 + );
287 + foreach ( $result['tags'] as $tag_id ) {
288 + $tags['tags'][] = array(
289 + 'id' => $tag_id,
290 + );
291 + }
266 292 }
267 293
268 294 // Bail if the subscriber has no tags.
269 295 if ( ! count( $tags ) ) {