Here we go.
1. Add the following code in index.php:
// Display the user categories if we're at the top.
if (empty($parent)) {
$sql = "SELECT user_id + " . FIRST_USER_CAT . " AS catID,
user_name
FROM {$CONFIG['TABLE_USERS']}
ORDER BY user_name";
$users = db_fetch_rowset(db_query($sql));
foreach ($users as $user) {
$sql = "SELECT COUNT(*)
FROM {$CONFIG['TABLE_ALBUMS']}
WHERE category = {$user[0]}";
$album = mysql_fetch_array(db_query($sql));
$sql = "SELECT COUNT(*)
FROM {$CONFIG['TABLE_ALBUMS']} JOIN {$CONFIG['TABLE_PICTURES']}
ON {$CONFIG['TABLE_ALBUMS']}.aid = {$CONFIG['TABLE_PICTURES']}.aid
WHERE {$CONFIG['TABLE_ALBUMS']}.category = {$user[0]}";
$picture = mysql_fetch_array(db_query($sql));
$cat_data[] = array("<a href=\"index.php?cat={$user[0]}\">{$user[1]}'s Photos</a>","","{$album[0]}","{$picture[0]}", 'cat_albums' => list_cat_albums($user[0]) );
}
}
right before
}
// List all categories
function get_cat_list(&$breadcrumb, &$cat_data, &$statistics)
Basicaly, you want that if statement to be the last thing in the get_subcat_data() function.
2. That's really it, just a few little things to tidy up. First, there is no need to
have the User Galleries category show up anymore. Change the following SQL:
SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '$parent' ORDER BY pos
to
SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '$parent' AND cid <> 1 ORDER BY pos
3. Next we need to have the stats reflecting our changes. Change this code block:
$result = db_query("SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1");
$nbEnr = mysql_fetch_array($result);
$cat_count = $nbEnr[0] - $HIDE_USER_CAT;
mysql_free_result($result);
to
$result = db_query("SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1");
$nbEnr = mysql_fetch_array($result);
$totalCats = $nbEnr[0];
$result = db_query("SELECT count(*) FROM {$CONFIG['TABLE_USERS']} WHERE 1");
$nbEnr = mysql_fetch_array($result);
$totalUsers = $nbEnr[0];
$cat_count = $totalCats - $HIDE_USER_CAT - 1 + $totalUsers;
mysql_free_result($result);
And you're done. The only thing left would be to add a row to your config table and turn
this into something you can turn on and off. To borrow from a bad textbook,
I'll leave that as an exercise to the reader.
I can always just post my index.php file. If you have 1.2.1 and haven't modified yours you can just replace it.