Index: trunk/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -101,20 +101,24 @@ |
102 | 102 | $data = array(); |
103 | 103 | $res = $this->select(__METHOD__); |
104 | 104 | while(($r = $db->fetchObject($res))) { |
105 | | - $data[$r->user_name]['name'] = $r->user_name; |
| 105 | + $user = User::newFromRow($r); |
| 106 | + $name = $user->getName(); |
| 107 | + $data[$name]['name'] = $name; |
106 | 108 | if(isset($this->prop['editcount'])) |
107 | | - $data[$r->user_name]['editcount'] = $r->user_editcount; |
| 109 | + // No proper member function in the User class for this |
| 110 | + $data[$name]['editcount'] = $r->user_editcount; |
108 | 111 | if(isset($this->prop['registration'])) |
109 | | - $data[$r->user_name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration); |
110 | | - if(isset($this->prop['groups'])) |
| 112 | + // Nor for this one |
| 113 | + $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration); |
| 114 | + if(isset($this->prop['groups']) && !is_null($r->ug_group)) |
111 | 115 | // This row contains only one group, others will be added from other rows |
112 | | - if(!is_null($r->ug_group)) |
113 | | - $data[$r->user_name]['groups'][] = $r->ug_group; |
114 | | - if(isset($this->prop['blockinfo'])) |
115 | | - if(!is_null($r->blocker_name)) { |
116 | | - $data[$r->user_name]['blockedby'] = $r->blocker_name; |
117 | | - $data[$r->user_name]['blockreason'] = $r->ipb_reason; |
118 | | - } |
| 116 | + $data[$name]['groups'][] = $r->ug_group; |
| 117 | + if(isset($this->prop['blockinfo']) && !is_null($r->blocker_name)) { |
| 118 | + $data[$name]['blockedby'] = $r->blocker_name; |
| 119 | + $data[$name]['blockreason'] = $r->ipb_reason; |
| 120 | + } |
| 121 | + if(isset($this->prop['emailable']) && $user->canReceiveEmail()) |
| 122 | + $data[$name]['emailable'] = ''; |
119 | 123 | } |
120 | 124 | } |
121 | 125 | // Second pass: add result data to $retval |