PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
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 2.3.1 All 196 releases
← All changes | includes/blocks/class-convertkit-block-content.php +31 -6 3.3.93.4.3 View file →
@@ -253,17 +253,42 @@
253 253 'output_content'
254 254 );
255 255
256 256 // Get the subscriber's tags, to see if they subscribed to this tag.
257 - $tags = $api->get_subscriber_tags( $subscriber_id );
257 + if ( is_numeric( $subscriber_id ) ) {
258 + $tags = $api->get_subscriber_tags( $subscriber_id );
258 259
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() . ' -->';
260 + // Bail if an error occurred.
261 + if ( is_wp_error( $tags ) ) {
262 + if ( $settings->debug_enabled() ) {
263 + return '<!-- Kit Custom Content: ' . $tags->get_error_message() . ' -->';
264 + }
265 +
266 + return '';
263 267 }
268 + } else {
269 + // Subscriber ID is a signed subscriber ID.
270 + // Get tags that the subscriber has access to via the profile() method.
271 + $result = $api->profile( $subscriber_id );
264 272
265 - return '';
273 + // If an error occurred, the subscriber ID is invalid.
274 + if ( is_wp_error( $result ) ) {
275 + if ( $settings->debug_enabled() ) {
276 + return '<!-- Kit Custom Content: ' . $result->get_error_message() . ' -->';
277 + }
278 +
279 + return '';
280 + }
281 +
282 + // Build tags array.
283 + $tags = array(
284 + 'tags' => array(),
285 + );
286 + foreach ( $result['tags'] as $tag_id ) {
287 + $tags['tags'][] = array(
288 + 'id' => $tag_id,
289 + );
290 + }
266 291 }
267 292
268 293 // Bail if the subscriber has no tags.
269 294 if ( ! count( $tags ) ) {