Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGift.php |
— | — | @@ -89,7 +89,11 @@ |
90 | 90 | $output .= '<div class="cleared"></div> |
91 | 91 | </div>'; |
92 | 92 | |
93 | | - $output .= '<div class="ga-recent"> |
| 93 | + // If someone else in addition to the current user has gotten this |
| 94 | + // award, then and only then show the "Other recipients of this |
| 95 | + // award" header and the list of avatars |
| 96 | + if ( $gift['gift_count'] > 1 ) { |
| 97 | + $output .= '<div class="ga-recent"> |
94 | 98 | <div class="ga-recent-title">' . |
95 | 99 | wfMsg( 'ga-recent-recipients-award' ) . |
96 | 100 | '</div> |
— | — | @@ -101,19 +105,21 @@ |
102 | 106 | ) . |
103 | 107 | '</div>'; |
104 | 108 | |
105 | | - foreach ( $res as $row ) { |
106 | | - $userToId = $row->sg_user_id; |
107 | | - $avatar = new wAvatar( $userToId, 'ml' ); |
108 | | - $userNameLink = Title::makeTitle( NS_USER, $row->sg_user_name ); |
| 109 | + foreach ( $res as $row ) { |
| 110 | + $userToId = $row->sg_user_id; |
| 111 | + $avatar = new wAvatar( $userToId, 'ml' ); |
| 112 | + $userNameLink = Title::makeTitle( NS_USER, $row->sg_user_name ); |
109 | 113 | |
110 | | - $output .= '<a href="' . $userNameLink->escapeFullURL() . "\"> |
| 114 | + $output .= '<a href="' . $userNameLink->escapeFullURL() . "\"> |
111 | 115 | {$avatar->getAvatarURL()} |
112 | 116 | </a>"; |
| 117 | + } |
| 118 | + |
| 119 | + $output .= '<div class="cleared"></div> |
| 120 | + </div>'; // .ga-recent |
113 | 121 | } |
114 | 122 | |
115 | | - $output .= '<div class="cleared"></div> |
116 | | - </div> |
117 | | - </div>'; |
| 123 | + $output .= '</div>'; |
118 | 124 | |
119 | 125 | $wgOut->addHTML( $output ); |
120 | 126 | } else { |
Index: trunk/extensions/SocialProfile/SystemGifts/UserSystemGiftsClass.php |
— | — | @@ -384,13 +384,14 @@ |
385 | 385 | * Update the counter that tracks how many times a system gift has been |
386 | 386 | * given out. |
387 | 387 | * |
388 | | - * @param $gift_id Integer: ID number of the system gift that we're tracking |
| 388 | + * @param $giftId Integer: ID number of the system gift that we're tracking |
389 | 389 | */ |
390 | | - private function incGiftGivenCount( $gift_id ) { |
| 390 | + public static function incGiftGivenCount( $giftId ) { |
391 | 391 | $dbw = wfGetDB( DB_MASTER ); |
392 | | - $dbw->update( 'system_gift', |
393 | | - array( 'gift_given_count=gift_given_count+1' ), |
394 | | - array( 'gift_id' => $gift_id ), |
| 392 | + $dbw->update( |
| 393 | + 'system_gift', |
| 394 | + array( 'gift_given_count = gift_given_count + 1' ), |
| 395 | + array( 'gift_id' => $giftId ), |
395 | 396 | __METHOD__ |
396 | 397 | ); |
397 | 398 | } |
Index: trunk/extensions/SocialProfile/SystemGifts/SystemGiftsClass.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | array( 'ORDER BY' => 'gift_category, gift_threshold ASC' ) |
54 | 54 | ); |
55 | 55 | |
56 | | - $x = 1; |
| 56 | + $x = 0; |
57 | 57 | foreach ( $res as $row ) { |
58 | 58 | if ( $row->gift_category ) { |
59 | 59 | $res2 = $dbw->select( |
— | — | @@ -83,6 +83,9 @@ |
84 | 84 | $sg_key = wfMemcKey( 'user', 'profile', 'system_gifts', "{$row2->stats_user_id}" ); |
85 | 85 | $wgMemc->delete( $sg_key ); |
86 | 86 | |
| 87 | + // Update counters (bug #27981) |
| 88 | + UserSystemGifts::incGiftGivenCount( $row->gift_id ); |
| 89 | + |
87 | 90 | $wgOut->addHTML( $row2->stats_user_name . ' got ' . $row->gift_name . '<br />' ); |
88 | 91 | $x++; |
89 | 92 | } |