@@ 1470-1483 (lines=14) @@ | ||
1467 | /** |
|
1468 | * Get the wpcom user data of the current|specified connected user. |
|
1469 | */ |
|
1470 | public static function get_connected_user_data( $user_id = null ) { |
|
1471 | if ( ! $user_id ) { |
|
1472 | $user_id = get_current_user_id(); |
|
1473 | } |
|
1474 | Jetpack::load_xml_rpc_client(); |
|
1475 | $xml = new Jetpack_IXR_Client( array( |
|
1476 | 'user_id' => $user_id, |
|
1477 | ) ); |
|
1478 | $xml->query( 'wpcom.getUser' ); |
|
1479 | if ( ! $xml->isError() ) { |
|
1480 | return $xml->getResponse(); |
|
1481 | } |
|
1482 | return false; |
|
1483 | } |
|
1484 | ||
1485 | /** |
|
1486 | * Get the wpcom email of the current|specified connected user. |
|
@@ 1488-1501 (lines=14) @@ | ||
1485 | /** |
|
1486 | * Get the wpcom email of the current|specified connected user. |
|
1487 | */ |
|
1488 | public static function get_connected_user_email( $user_id = null ) { |
|
1489 | if ( ! $user_id ) { |
|
1490 | $user_id = get_current_user_id(); |
|
1491 | } |
|
1492 | Jetpack::load_xml_rpc_client(); |
|
1493 | $xml = new Jetpack_IXR_Client( array( |
|
1494 | 'user_id' => $user_id, |
|
1495 | ) ); |
|
1496 | $xml->query( 'wpcom.getUserEmail' ); |
|
1497 | if ( ! $xml->isError() ) { |
|
1498 | return $xml->getResponse(); |
|
1499 | } |
|
1500 | return false; |
|
1501 | } |
|
1502 | ||
1503 | /** |
|
1504 | * Get the wpcom email of the master user. |
@@ 146-161 (lines=16) @@ | ||
143 | <?php |
|
144 | } |
|
145 | ||
146 | function get_post_by_email_address() { |
|
147 | Jetpack::load_xml_rpc_client(); |
|
148 | $xml = new Jetpack_IXR_Client( array( |
|
149 | 'user_id' => get_current_user_id(), |
|
150 | ) ); |
|
151 | $xml->query( 'jetpack.getPostByEmailAddress' ); |
|
152 | ||
153 | if ( $xml->isError() ) |
|
154 | return NULL; |
|
155 | ||
156 | $response = $xml->getResponse(); |
|
157 | if ( empty( $response ) ) |
|
158 | return NULL; |
|
159 | ||
160 | return $response; |
|
161 | } |
|
162 | ||
163 | function create_post_by_email_address() { |
|
164 | Jetpack::load_xml_rpc_client(); |
@@ 520-535 (lines=16) @@ | ||
517 | <?php |
|
518 | } |
|
519 | ||
520 | static function delete_connection_for_user( $user_id ) { |
|
521 | if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) { |
|
522 | return; |
|
523 | } |
|
524 | Jetpack::load_xml_rpc_client(); |
|
525 | $xml = new Jetpack_IXR_Client( array( |
|
526 | 'user_id' => $user_id |
|
527 | ) ); |
|
528 | $xml->query( 'jetpack.sso.removeUser', $wpcom_user_id ); |
|
529 | ||
530 | if ( $xml->isError() ) { |
|
531 | return false; |
|
532 | } |
|
533 | ||
534 | return $xml->getResponse(); |
|
535 | } |
|
536 | ||
537 | static function request_initial_nonce() { |
|
538 | Jetpack::load_xml_rpc_client(); |