Extension talk:Friends.php

From Organic Design wiki
Revision as of 03:43, 25 March 2008 by Nad (talk | contribs)

sql query (to get names of users who have edited a particular page):

select distinct user_name from user,revision where user.user_id = revision.rev_user and revision.rev_page = 5000;

Parser function

In this context we obtain the title_id in this way:

$id = $wgTitle->getArticleID();

$dbr  = &wfGetDB(DB_SLAVE);
$u = $dbr->tableName('user');
$r = $dbr->tableName('revision');

$sql = "select distinct user_name from $u,$r where $u.user_id = $r.rev_user and $r.rev_page = $id;";
$res  = $dbr->query($sql);

while ($row = $dbr->fetchRow($res)) $list[] = $row[0];
print_r($list);