View Full Version : Display Number Of Links Awaiting Approval
bwp58
04-25-2006, 08:11 AM
Did about a dozen searches for this but couldnt find in the forum.
Can any one tell me how to display the number of links awaiting approval, on the front page of my directory please.
I'm running 3.04 (which is performing very well - thanks guys)
Thanks in advance
Brian
bwp58
04-25-2006, 09:32 AM
Thanks Anon
Can you bear with me a bit.
Have defined this in the index file:
$stats[0] = $db->GetOne("SELECT COUNT(*) FROM {$tables['link']['name']} WHERE STATUS = 2");
$stats[3] = $db->GetOne("SELECT COUNT(*) FROM {$tables['category']['name']} WHERE STATUS = 2");
$tpl->assign('stats', $stats);
$stats[4] = $db->GetOne("SELECT COUNT(*) FROM {$tables['status']['name']} WHERE STATUS = 1");
$tpl->assign('stats', $stats);
The last two lines are my attempt to define the variable which tracks link status - fumbled around the database & worked out that when the link status is 1 its awaiting approval which is what I'm trying to count.
Then threw this in the footer:
{l}Active Links{/l} - {$stats[0]}
{l}Categories{/l} - {$stats[3]}
{l}Awaiting Approval{/l} - {$stats[4]}
The active links & categories displays fine but nothing for "awaiting approval"
Can you tell me where to find the variable in the $tables which tracks this attribute.
Thanks
Brian
try
stats[1] = $db->GetOne("SELECT COUNT(*) FROM {$tables['link']['name']} WHERE STATUS = 1");
wait a sec. i didnt even look at the code there. only looked at what you wanted.
i just looked at the code now, and stats[4] does that. thats pending. aka waiting to be approved/limbo
also, why are you assigning stats[] 2 times? once should be enough, and at the end of all the code.
bwp58
04-25-2006, 10:15 AM
Your a champion - works perfectly
Many thanks - a small token of appreciation is on our website.
Regards
Brian
pachimondai
04-25-2006, 11:18 AM
Hey
here's another one if you wanna try it too
It worked for me!
{topic moved or deleted}
bwp58
04-25-2006, 11:31 AM
Very nice - much more elegant than my hack
Thanks for the links
Regards
Brian
imho, I like the way you have it setup now much better than that other way.
Rob
minute
04-25-2006, 04:23 PM
I think this thread has given me a clue how to display my extra fields. :)
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.