| @@ 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(); |
|
| @@ 1173-1186 (lines=14) @@ | ||
| 1170 | /** |
|
| 1171 | * Get the wpcom user data of the current|specified connected user. |
|
| 1172 | */ |
|
| 1173 | public static function get_connected_user_data( $user_id = null ) { |
|
| 1174 | if ( ! $user_id ) { |
|
| 1175 | $user_id = get_current_user_id(); |
|
| 1176 | } |
|
| 1177 | Jetpack::load_xml_rpc_client(); |
|
| 1178 | $xml = new Jetpack_IXR_Client( array( |
|
| 1179 | 'user_id' => $user_id, |
|
| 1180 | ) ); |
|
| 1181 | $xml->query( 'wpcom.getUser' ); |
|
| 1182 | if ( ! $xml->isError() ) { |
|
| 1183 | return $xml->getResponse(); |
|
| 1184 | } |
|
| 1185 | return false; |
|
| 1186 | } |
|
| 1187 | ||
| 1188 | /** |
|
| 1189 | * Get the wpcom email of the current|specified connected user. |
|
| @@ 1191-1204 (lines=14) @@ | ||
| 1188 | /** |
|
| 1189 | * Get the wpcom email of the current|specified connected user. |
|
| 1190 | */ |
|
| 1191 | public static function get_connected_user_email( $user_id = null ) { |
|
| 1192 | if ( ! $user_id ) { |
|
| 1193 | $user_id = get_current_user_id(); |
|
| 1194 | } |
|
| 1195 | Jetpack::load_xml_rpc_client(); |
|
| 1196 | $xml = new Jetpack_IXR_Client( array( |
|
| 1197 | 'user_id' => $user_id, |
|
| 1198 | ) ); |
|
| 1199 | $xml->query( 'wpcom.getUserEmail' ); |
|
| 1200 | if ( ! $xml->isError() ) { |
|
| 1201 | return $xml->getResponse(); |
|
| 1202 | } |
|
| 1203 | return false; |
|
| 1204 | } |
|
| 1205 | ||
| 1206 | /** |
|
| 1207 | * Get the wpcom email of the master user. |
|