Skip to content

Commit

Permalink
Fixes #612: Limit user data for the translations endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Nov 21, 2016
1 parent 6824632 commit dd0d44e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions gp-includes/things/translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,27 @@ public function for_translation( $project, $translation_set, $page, $filters = a
$row->user = $row->user_last_modified = null;

if ( $row->user_id && 'no-limit' !== $this->per_page ) {
$row->user = get_userdata( $row->user_id );
$user = get_userdata( $row->user_id );
if ( $user ) {
$row->user = (object) array(
'ID' => $user->ID,
'user_login' => $user->user_login,
'display_name' => $user->display_name,
'user_nicename' => $user->user_nicename,
);
}
}

if ( $row->user_id_last_modified && 'no-limit' !== $this->per_page ) {
$row->user_last_modified = get_userdata( $row->user_id_last_modified );
$user = get_userdata( $row->user_id_last_modified );
if ( $user ) {
$row->user_last_modified = (object) array(
'ID' => $user->ID,
'user_login' => $user->user_login,
'display_name' => $user->display_name,
'user_nicename' => $user->user_nicename,
);
}
}

$row->translations = array();
Expand Down

0 comments on commit dd0d44e

Please sign in to comment.