Plugin Directory

Changeset 797294

Timestamp:
11/01/2013 03:41:41 PM (11 years ago)
Author:
jshreve
Message:

REST API

Stop fatal errors from wpcom_subs_total_wpcom_subscribers not being avaiable and instead do the calculation on the WordPress.com side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/class.json-api-endpoints.php

    r795944 r797294  
    30393039                break;
    30403040            case 'subscribers_count' :
    3041                 $total_wpcom_subs = wpcom_subs_total_wpcom_subscribers(
    3042                     array(
    3043                         'blog_id' => $blog_id,
    3044                     )
    3045                 );
    3046                 $response[$key] = $total_wpcom_subs;
     3041                if ( function_exists( 'wpcom_subs_total_wpcom_subscribers' ) ) {
     3042                    $total_wpcom_subs = wpcom_subs_total_wpcom_subscribers(
     3043                        array(
     3044                            'blog_id' => $blog_id,
     3045                        )
     3046                    );
     3047                    $response[$key] = $total_wpcom_subs;
     3048                } else {
     3049                    $response[$key] = 0; // magic
     3050                }
    30473051                break;
    30483052            case 'meta' :
Note: See TracChangeset for help on using the changeset viewer.