This is a first draft of a function (static page) that can change the owner of any internatal item. To try it, paste the code into a static page (return-type PHP) and call it with a link as described in the first lines of the code, adapted with a valid item's id.
Please tell me what you think. This could become a plugin, but I rather count on it beeing implemented into the core.
to implement this, one could either simply write another function that lets you choose the item to change from here. Otherwise, one would have to edit the admin pages and insert a link that would point to this function.
Text Formatted Code
# call this as :
# http://yoursite.com/staticpages/index.php?page=changeowner&changewhat=stories&item_id=20041018095452567¤t_owner=2
# $what has to be one of the following: "comments", "events", "stories", "links"
$action=$_GET['action'];
if (!SEC_inGroup('Root')) {exit;}
if (empty($action)) {$action="select_new_owner";}
return $action();
function select_new_owner()
{
global $_TABLES;
$what=$_GET['changewhat'];
$item_id=$_GET['item_id'];
$current_owner=$_GET['current_owner'];
$table=$_TABLES[$what];
$out.=COM_startBlock("Please select a new Owner of this $what:");
$user_sql="SELECT * FROM {$_TABLES['users']} ORDER by `username`;";
$user_records=DB_query($user_sql);
$out.="<FORM action=\"./index.php\" method=\"GET\">\n";
$out.="<input type=\"hidden\" name=\"page\" value=\"changeowner\">\n";
$out.="<input type=\"hidden\" name=\"table\" value=\"$what\">\n";
$out.="<input type=\"hidden\" name=\"action\" value=\"save_new_owner\">\n";
$out.="<input type=\"hidden\" name=\"item_id\" value=\"$item_id\">\n";
$out.="Username: <select name=\"new_uid\">\n";
for ($i=0;$i<DB_numRows($user_records);$i++)
{
$A=DB_fetchArray($user_records);
$username=$A['username'];
$u_id=$A['uid'];
if ($current_owner==$u_id) {$sel=" selected";} else {$sel="";}
$out.="<option value=\"$u_id\"$sel>$username</option>\n";
}
$out.="</select><input type=\"submit\"></form>";
$out.=COM_endBlock();
return $out;
}
function save_new_owner()
{
global $_TABLES;
$what=$_GET['table'];
$table_id=substr($what,0,1) . "id";
$table=$_TABLES[$what];
$item_id=$_GET['item_id'];
$new_uid=$_GET['new_uid'];
$update_sql="UPDATE $table SET uid=$new_uid WHERE $table_id='$item_id' LIMIT 1";
DB_query($update_sql);
$out="The ID has been changed!";
return $out;
}