I am updating the MediaWiki extension, which displays all the images in a category ( CategoryGallery ).
I would like to show the name of the user who uploaded the image, and then possibly to filter by user.
Part of the code looks like this:
$params['cat'] = str_replace ( ' ', '_', ucfirst( $params['cat'] ) );
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'categorylinks', 'cl_from',
array ('cl_to' => $params['cat'],
'cl_type' => 'file'));
$ids = array();
foreach ( $res as $row ) {
$ids[] = $row->cl_from;
}
$titles = Title::newFromIDs ( $ids );
$text = '';
foreach ( $titles as $title ) {
$titlePrefixedDBKey = $title->getPrefixedDBKey();
$text .= $titlePrefixedDBKey;
$text .= "|**Username**:\n";
}
$output = $parser->renderImageGallery( $text, $params )
How can I get the name of the user who uploaded the photo to display it in the image gallery (where I posted the Username )?
source
share