| @@ -185,10 +185,18 @@ | ||
| 185 | 185 | if ( ! empty( $this->meta['user_role'] ) && isset( $wp_roles->role_names[ $this->meta['user_role'] ] ) ) { |
| 186 | 186 | $user_role = $wp_roles->role_names[ $this->meta['user_role'] ]; |
| 187 | 187 | } elseif ( ! empty( $this->meta['user_role_label'] ) ) { |
| 188 | 188 | $user_role = $this->meta['user_role_label']; |
| 189 | - } elseif ( isset( $this->user->roles[0] ) && isset( $wp_roles->role_names[ $this->user->roles[0] ] ) ) { | |
| 190 | - $user_role = $wp_roles->role_names[ $this->user->roles[0] ]; | |
| 189 | + } elseif ( ! empty( $this->user->roles ) ) { | |
| 190 | + $roles = array_map( | |
| 191 | + function( $role ) use ( $wp_roles ) { | |
| 192 | + return $wp_roles->role_names[ $role ]; | |
| 193 | + }, | |
| 194 | + $this->user->roles | |
| 195 | + ); | |
| 196 | + | |
| 197 | + $separator = apply_filters( 'wp_stream_get_role_list_separator', ' - ' ); | |
| 198 | + $user_role = implode( $separator, $roles ); | |
| 191 | 199 | } elseif ( is_multisite() && is_super_admin( $this->id ) ) { |
| 192 | 200 | $user_role = $wp_roles->role_names['administrator']; |
| 193 | 201 | } |
| 194 | 202 | |
| @@ -213,24 +221,20 @@ | ||
| 213 | 221 | return ( 'wp_cli' === $this->get_agent() ); |
| 214 | 222 | } |
| 215 | 223 | |
| 216 | 224 | /** |
| 217 | - * True if doing WP Cron, otherwise false | |
| 225 | + * Check if the current request is part of a WP cron task. | |
| 218 | 226 | * |
| 219 | - * Note: If native WP Cron has been disabled and you are | |
| 220 | - * hitting the cron endpoint with a system cron job, this | |
| 221 | - * method will always return false. | |
| 227 | + * Note: This will return true for all manual or custom | |
| 228 | + * cron runs even if the default front-end cron is disabled. | |
| 222 | 229 | * |
| 230 | + * We're not using `wp_doing_cron()` since it was introduced | |
| 231 | + * only in WordPress 4.8.0. | |
| 232 | + * | |
| 223 | 233 | * @return bool |
| 224 | 234 | */ |
| 225 | 235 | public function is_doing_wp_cron() { |
| 226 | - return ( | |
| 227 | - wp_stream_is_cron_enabled() | |
| 228 | - && | |
| 229 | - defined( 'DOING_CRON' ) | |
| 230 | - && | |
| 231 | - DOING_CRON | |
| 232 | - ); | |
| 236 | + return ( defined( 'DOING_CRON' ) && DOING_CRON ); | |
| 233 | 237 | } |
| 234 | 238 | |
| 235 | 239 | /** |
| 236 | 240 | * Look at the environment to detect if an agent is being used |