← All changes
|
jetpack_vendor/automattic/jetpack-sync/src/class-users.php
+6
-3
12.0.3
→
16.3-a.1
View file →
| @@ -53,9 +53,11 @@ | ||
| 53 | 53 | */ |
| 54 | 54 | public static function user_role_change( $user_id ) { |
| 55 | 55 | $connection = new Jetpack_Connection(); |
| 56 | 56 | if ( $connection->is_user_connected( $user_id ) ) { |
| 57 | + self::get_role( $user_id ); | |
| 57 | 58 | self::update_role_on_com( $user_id ); |
| 59 | + | |
| 58 | 60 | // Try to choose a new master if we're demoting the current one. |
| 59 | 61 | self::maybe_demote_master_user( $user_id ); |
| 60 | 62 | } |
| 61 | 63 | } |
| @@ -65,13 +67,14 @@ | ||
| 65 | 67 | * |
| 66 | 68 | * @access public |
| 67 | 69 | * @static |
| 68 | 70 | * |
| 69 | - * @param int $user_id ID of the user. | |
| 71 | + * @param int $user_id ID of the user. | |
| 72 | + * @param bool $reload Forces reading the role from the database. | |
| 70 | 73 | * @return string Role of the user. |
| 71 | 74 | */ |
| 72 | - public static function get_role( $user_id ) { | |
| 73 | - if ( isset( self::$user_roles[ $user_id ] ) ) { | |
| 75 | + public static function get_role( $user_id, $reload = false ) { | |
| 76 | + if ( ! $reload && isset( self::$user_roles[ $user_id ] ) ) { | |
| 74 | 77 | return self::$user_roles[ $user_id ]; |
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | $current_user_id = get_current_user_id(); |