|
@@ 520-528 (lines=9) @@
|
| 517 |
|
* |
| 518 |
|
* @return string|int Returns the ID of the connection owner or False if no connection owner found. |
| 519 |
|
*/ |
| 520 |
|
public function get_connection_owner_id() { |
| 521 |
|
$user_token = $this->get_access_token( JETPACK_MASTER_USER ); |
| 522 |
|
$connection_owner = false; |
| 523 |
|
if ( $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) ) { |
| 524 |
|
$connection_owner = $user_token->external_user_id; |
| 525 |
|
} |
| 526 |
|
|
| 527 |
|
return $connection_owner; |
| 528 |
|
} |
| 529 |
|
|
| 530 |
|
/** |
| 531 |
|
* Get the wpcom user data of the current|specified connected user. |
|
@@ 572-580 (lines=9) @@
|
| 569 |
|
* @param Integer|Boolean $user_id the user identifier. False for current user. |
| 570 |
|
* @return Boolean True the user the connection owner, false otherwise. |
| 571 |
|
*/ |
| 572 |
|
public function is_connection_owner( $user_id = false ) { |
| 573 |
|
if ( ! $user_id ) { |
| 574 |
|
$user_id = get_current_user_id(); |
| 575 |
|
} |
| 576 |
|
|
| 577 |
|
$user_token = $this->get_access_token( JETPACK_MASTER_USER ); |
| 578 |
|
|
| 579 |
|
return $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) && $user_id === $user_token->external_user_id; |
| 580 |
|
} |
| 581 |
|
|
| 582 |
|
/** |
| 583 |
|
* Unlinks the current user from the linked WordPress.com user. |