Changeset 5869
- Timestamp:
- 09/03/2017 09:47:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-badges/inc/class-plugin.php
r5523 r5869 199 199 } elseif ( $this->is_user_contributor( $info['user_nicename'], $info['type'], $info['slug'] ) ) { 200 200 $contrib_type = 'contributor'; 201 } elseif ( $this->is_user_support_rep( $info['user_nicename'], $info['type'], $info['slug'] ) ) { 202 $contrib_type = 'support-rep'; 201 203 } else { 202 204 $contrib_type = ''; … … 313 315 } 314 316 } 317 elseif ( $this->is_user_support_rep( $info['user_nicename'], $info['type'], $info['slug'] ) ) { 318 if ( 'plugin' == $info['type'] ) { 319 $label = __( 'Plugin Support', 'wporg-forums' ); 320 $help = __( 'This person is a support representative for this plugin', 'wporg-forums' ); 321 } else { 322 $label = __( 'Theme Support', 'wporg-forums' ); 323 $help = __( 'This person is a support representative for this theme', 'wporg-forums' ); 324 } 325 } 315 326 316 327 return $label ? array( 'type' => $info['type'], 'label' => $label, 'help' => $help ) : false; … … 388 399 389 400 return $contributors && in_array( $user_nicename, $contributors ); 401 } 402 403 /** 404 * Checks if the specified user is a support rep for the specified plugin/theme. 405 * 406 * A support representative is someone assigned as such by the plugin or theme author. 407 * 408 * @param string $user_nicename User slug. 409 * @param string $type Either 'plugin' or 'theme'. 410 * @param string $slug Slug for the plugin or theme. 411 * @return bool True if user is a support rep, false otherwise. 412 */ 413 public function is_user_support_rep( $user_nicename, $type, $slug ) { 414 if ( class_exists( '\WordPressdotorg\Forums\Plugin' ) ) { 415 if ( 'plugin' === $type ) { 416 $compat = \WordPressdotorg\Forums\Plugin::get_instance()->plugins; 417 } else { 418 $compat = \WordPressdotorg\Forums\Plugin::get_instance()->themes; 419 } 420 } else { 421 $compat = null; 422 } 423 424 $support_reps = $compat ? $compat->get_support_reps( $slug ) : array(); 425 426 return $support_reps && in_array( $user_nicename, $support_reps ); 390 427 } 391 428
Note: See TracChangeset
for help on using the changeset viewer.