@@ 525-540 (lines=16) @@ | ||
522 | <?php |
|
523 | } |
|
524 | ||
525 | static function delete_connection_for_user( $user_id ) { |
|
526 | if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) { |
|
527 | return; |
|
528 | } |
|
529 | Jetpack::load_xml_rpc_client(); |
|
530 | $xml = new Jetpack_IXR_Client( array( |
|
531 | 'user_id' => $user_id |
|
532 | ) ); |
|
533 | $xml->query( 'jetpack.sso.removeUser', $wpcom_user_id ); |
|
534 | ||
535 | if ( $xml->isError() ) { |
|
536 | return false; |
|
537 | } |
|
538 | ||
539 | return $xml->getResponse(); |
|
540 | } |
|
541 | ||
542 | static function request_initial_nonce() { |
|
543 | Jetpack::load_xml_rpc_client(); |
@@ 129-144 (lines=16) @@ | ||
126 | <?php |
|
127 | } |
|
128 | ||
129 | function get_post_by_email_address() { |
|
130 | Jetpack::load_xml_rpc_client(); |
|
131 | $xml = new Jetpack_IXR_Client( array( |
|
132 | 'user_id' => get_current_user_id(), |
|
133 | ) ); |
|
134 | $xml->query( 'jetpack.getPostByEmailAddress' ); |
|
135 | ||
136 | if ( $xml->isError() ) |
|
137 | return NULL; |
|
138 | ||
139 | $response = $xml->getResponse(); |
|
140 | if ( empty( $response ) ) |
|
141 | return NULL; |
|
142 | ||
143 | return $response; |
|
144 | } |
|
145 | ||
146 | function create_post_by_email_address() { |
|
147 | Jetpack::load_xml_rpc_client(); |
@@ 1258-1271 (lines=14) @@ | ||
1255 | /** |
|
1256 | * Get the wpcom user data of the current|specified connected user. |
|
1257 | */ |
|
1258 | public static function get_connected_user_data( $user_id = null ) { |
|
1259 | if ( ! $user_id ) { |
|
1260 | $user_id = get_current_user_id(); |
|
1261 | } |
|
1262 | Jetpack::load_xml_rpc_client(); |
|
1263 | $xml = new Jetpack_IXR_Client( array( |
|
1264 | 'user_id' => $user_id, |
|
1265 | ) ); |
|
1266 | $xml->query( 'wpcom.getUser' ); |
|
1267 | if ( ! $xml->isError() ) { |
|
1268 | return $xml->getResponse(); |
|
1269 | } |
|
1270 | return false; |
|
1271 | } |
|
1272 | ||
1273 | /** |
|
1274 | * Get the wpcom email of the current|specified connected user. |
|
@@ 1276-1289 (lines=14) @@ | ||
1273 | /** |
|
1274 | * Get the wpcom email of the current|specified connected user. |
|
1275 | */ |
|
1276 | public static function get_connected_user_email( $user_id = null ) { |
|
1277 | if ( ! $user_id ) { |
|
1278 | $user_id = get_current_user_id(); |
|
1279 | } |
|
1280 | Jetpack::load_xml_rpc_client(); |
|
1281 | $xml = new Jetpack_IXR_Client( array( |
|
1282 | 'user_id' => $user_id, |
|
1283 | ) ); |
|
1284 | $xml->query( 'wpcom.getUserEmail' ); |
|
1285 | if ( ! $xml->isError() ) { |
|
1286 | return $xml->getResponse(); |
|
1287 | } |
|
1288 | return false; |
|
1289 | } |
|
1290 | ||
1291 | /** |
|
1292 | * Get the wpcom email of the master user. |