So my version of the above now looks like (note the function name changed slightly):
Text Formatted Code
function phpblock_submissions()
{
global $_TABLES, $_CONF;
if (!SEC_hasRights('story.moderate,story.edit', 'OR')) {
return ''; // no block for folks without permission
}
$res = DB_query("SELECT title FROM {$_TABLES['storysubmission']} "
. COM_getTopicSql() . " ORDER BY DATE desc");
$num = DB_numRows($res);
$res = DB_query("SELECT title FROM {$_TABLES['linksubmission']} "
. COM_getTopicSql() . " ORDER BY DATE desc");
$num_link = DB_numRows($res);
$res = DB_query("SELECT title FROM {$_TABLES['eventsubmission']} "
. COM_getTopicSql() . " ORDER BY DATESTART desc");
$num_event = DB_numRows($res);
$sql = "SELECT uid as id,username,fullname,email FROM {$_TABLES['users']} WHERE status = 2";
$res = DB_query ($sql);
$num_user = DB_numRows($res);
$display = "$num stories, $num_link links, $num_event events and $num_user new users in "
. "<a href=\"{$_CONF['site_admin_url']}/moderation.php\">submissions</a>";
return $display;
}
So it borrows bits from here and there and has more sorting and fields than needed. Basically it will always show a block to admin users which looks something like this:
Even if all categories are empty I like to show it, just to reassure myself that it's still working and visible.