Changeset 458 for sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php
- Timestamp:
- 03/06/2014 04:56:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php
r402 r458 92 92 } 93 93 94 function get_trac_ticket_stars( $ticket_id ) { 95 return $this->trac->get_col( $this->trac->prepare( "SELECT username FROM _ticket_subs WHERE ticket = %s AND status = 1", $ticket_id ) ); 94 function get_trac_ticket_subscriptions( $ticket_id ) { 95 $by_status = array( 'blocked' => array(), 'starred' => array() ); 96 $subscriptions = $this->trac->get_results( $this->trac->prepare( "SELECT username, status FROM _ticket_subs WHERE ticket = %s", $ticket_id ) ); 97 foreach ( $subscriptions as $subscription ) { 98 $by_status[ $subscription->status ? 'starred' : 'blocked' ][] = $subscription->username; 99 } 100 return $by_status; 96 101 } 97 102 … … 254 259 $ticket_sub = $this->get_trac_ticket_subscription_status_for_user( $ticket_id, $username ); 255 260 256 $stars = $this->get_trac_ticket_stars( $ticket_id ); 261 $ticket_subscriptions = $this->get_trac_ticket_subscriptions( $ticket_id ); 262 $stars = $ticket_subscriptions['starred']; 257 263 $star_count = count( $stars ); 258 264 259 265 $participants = $this->get_trac_ticket_participants( $ticket_id ); 266 267 $unblocked_participants = array_diff( $participants, $ticket_subscriptions['blocked'] ); 268 $all_receiving_notifications = array_unique( array_merge( $stars, $unblocked_participants ) ); 269 sort( $all_receiving_notifications ); 260 270 261 271 $reasons = array(); … … 310 320 $class .= ' count-' . $star_count; 311 321 } 322 if ( ! empty( $_COOKIE['wp_trac_ngrid'] ) ) { 323 $class .= ' show-usernames'; 324 } 325 312 326 ob_start(); 313 327 ?> … … 322 336 <?php 323 337 foreach ( $stars as $follower ) : 338 // foreach ( $all_receiving_notifications as $follower ) : 324 339 if ( $username === $follower ) { 325 340 continue; 326 341 } 327 342 $follower = esc_attr( $follower ); 343 $class = ''; // in_array( $follower, $stars, true ) ? ' class="star"' : ''; 328 344 ?> 329 <a title="<?php echo $follower; ?>" href="//profiles.wordpress.org/<?php echo $follower; ?>">345 <a<?php echo $class; ?> title="<?php echo $follower; ?>" href="//profiles.wordpress.org/<?php echo $follower; ?>"> 330 346 <img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=<?php echo $follower; ?>&s=36" /> 347 <span class="username"><?php echo $follower; ?></span> 331 348 </a> 332 349 <?php endforeach; ?> 333 350 <a title="you" class="star-you" href="//profiles.wordpress.org/<?php echo esc_attr( $username ); ?>"> 334 351 <img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=<?php echo esc_attr( $username ); ?>&s=36" /> 352 <span class="username"><?php echo $username; ?></span> 335 353 </a> 336 354 </div> … … 341 359 <?php endif ?> 342 360 <p class="not-receiving-notifications">You do not receive notifications because you have blocked this ticket. <a href="#" class="button button-small unblock-notifications">Unblock</a></p> 343 < a class="preferences" href="<?php echo home_url( 'notifications/' ); ?>">Preferences</a>361 <span class="preferences"><span class="grid-toggle"><a href="#" class="grid dashicons dashicons-screenoptions"></a> <a href="#" class="names dashicons dashicons-exerpt-view dashicons-excerpt-view"></a></span> <a href="<?php echo home_url( 'notifications/' ); ?>">Preferences</a></span> 344 362 </fieldset> 345 363 </div>
Note: See TracChangeset
for help on using the changeset viewer.