Ive tried to make a phpblock that returns a count for the table storysubmission, to make submissions be more visible for story admins as a reminder to approve new submissions.
Lifted some code used to make count in the adminmenu, but couldent make it work.
Has anyone some suggestions/code to help me with?

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);$list='';// make a list of waiting stories so when there's a backlog, it's more noticeable.for($i=0;$i<5 AND $row= DB_fetchArray($res);++$i){$list.="<li>{$row['title']}</li>\n";}$display='';if(!empty($list)){$display="Last $i of $num waiting "."<a href=\"{$_CONF['site_admin_url']}/moderation.php\">story submissions</a>"."<ul>$list</ul>";}return$display;}

Thanks so much jmucchiello!
Just what I tried to achieve!
For others who may want to use this nice code, remember to add a missing ")" in the db-query.
From this: . COM_getTopicSql() . " ORDER BY DATE desc";
To this: . COM_getTopicSql() . " ORDER BY DATE desc");

glmenu makes my site look much nicer and saves real estate, but meant story submissions weren't "in the face" or the editors. With this little block they now are. I'll have to extend it to other submissions too.

OK, this works a bit better. Not tarted up perfectly but does the job for me and the typical rights I allocate to users, i.e. story, links, events and for full admin, also user moderation.

So I could check the rights on each step if this was production code, but for now I've just checked if they have story rights, and if so assume they have links and events too. If they also have user mod rights then the number of new user submissions is shown, else just a ? to indicate that the person isn't logged in with enough privilege to check (I have editors who generally have some rights but only log in as full admin occasionally).

So my new version is:

PHP Formatted Code

function phpblock_submissions(){global$_TABLES,$_CONF;

$display='';

if(!SEC_hasRights('story.moderate,story.edit','OR')){return$display;// 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']} ");

$num_link= DB_numRows($res);

$res= DB_query("SELECT title FROM {$_TABLES['eventsubmission']}");$num_event= DB_numRows($res);