Oh, and everything for your sorting selectors in album.php neglects prefixes too:
Code:
$users = $DB_site->query("
SELECT ".TABLE_PREFIX."user.userid, ".TABLE_PREFIX."user.username, ".TABLE_PREFIX."user.usergroupid,
".TABLE_PREFIX."user.usertitle, ".TABLE_PREFIX."usertextfield.signature, ".TABLE_PREFIX."usertextfield.sigdateline,
".TABLE_PREFIX."avatar.avatarpath, ".TABLE_PREFIX."user.avatarrevision, NOT ISNULL(".TABLE_PREFIX."customavatar.avatardata) AS hascustomavatar,
".TABLE_PREFIX."customavatar.dateline AS avatardateline
FROM ".TABLE_PREFIX."user
LEFT JOIN ".TABLE_PREFIX."usertextfield
USING (userid)
LEFT JOIN ".TABLE_PREFIX."avatar AS ".TABLE_PREFIX."avatar
ON(".TABLE_PREFIX."avatar.avatarid = ".TABLE_PREFIX."user.avatarid)
LEFT JOIN ".TABLE_PREFIX."customavatar AS ".TABLE_PREFIX."customavatar
ON(".TABLE_PREFIX."customavatar.userid = ".TABLE_PREFIX."user.userid)
WHERE ".TABLE_PREFIX."usertextfield.signature!=''$condition
ORDER BY " . ($sort == 'dateline' ? 'sigdateline' : $sort) . " $order
LIMIT " . ($minlimit-1) . ", $perpage
");