@@ 81-102 (lines=22) @@ | ||
78 | * |
|
79 | * @return bool |
|
80 | */ |
|
81 | function jetpack_are_other_users_linked_and_admin() { |
|
82 | // If only one admin |
|
83 | $all_users = count_users(); |
|
84 | if ( 2 > $all_users['avail_roles']['administrator'] ) { |
|
85 | return false; |
|
86 | } |
|
87 | ||
88 | $users = get_users(); |
|
89 | $available = array(); |
|
90 | // If no one else is linked to dotcom |
|
91 | foreach ( $users as $user ) { |
|
92 | if ( isset( $user->caps['administrator'] ) && Jetpack::is_user_connected( $user->ID ) ) { |
|
93 | $available[] = $user->ID; |
|
94 | } |
|
95 | } |
|
96 | ||
97 | if ( 2 > count( $available ) ) { |
|
98 | return false; |
|
99 | } |
|
100 | ||
101 | return true; |
|
102 | } |
|
103 | ||
104 | /* |
|
105 | * All the data we'll need about the Master User |
@@ 212-233 (lines=22) @@ | ||
209 | * |
|
210 | * @return mixed False if no other users are linked, Int if there are. |
|
211 | */ |
|
212 | function jetpack_get_other_linked_users() { |
|
213 | // If only one admin |
|
214 | $all_users = count_users(); |
|
215 | if ( 2 > $all_users['avail_roles']['administrator'] ) { |
|
216 | return false; |
|
217 | } |
|
218 | ||
219 | $users = get_users(); |
|
220 | $available = array(); |
|
221 | // If no one else is linked to dotcom |
|
222 | foreach ( $users as $user ) { |
|
223 | if ( isset( $user->caps['administrator'] ) && Jetpack::is_user_connected( $user->ID ) ) { |
|
224 | $available[] = $user->ID; |
|
225 | } |
|
226 | } |
|
227 | ||
228 | if ( 2 > count( $available ) ) { |
|
229 | return false; |
|
230 | } |
|
231 | ||
232 | return count( $available ); |
|
233 | } |
|
234 | ||
235 | /* |
|
236 | * Gather data about the master user. |