PDA


View Full Version : Add Links Awaiting Moderation to Your vBa CMPS Quick Moderation Module


Brian
07-19-2004, 04:12 PM
This is a fairly easy hack, but I'm sure will be very useful for those who also have the CMPS installed. As the title states, it will add the number of links awaiting moderation to your 'Quick Moderation' module in the CMPS.

First, open your /forum/modules/moderat.php file and look for:

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_moderation') . '";');

Right Above that, Add:

$links = $DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "links WHERE valid = 0");


Then open your 'adv_portal_moderate' template and add the following code where you wish:
<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validate" target="_blank">Links</a> ($links[count])</div>

That's it. :)

Shon
07-19-2004, 04:41 PM
Worked perfectly, thank you :)

Brian
07-19-2004, 04:44 PM
I like what you did with that module. :)

Shon
07-19-2004, 05:01 PM
I like what you did with that module. :)
Why thank you :D

bezzell
07-22-2004, 10:52 PM
Hmmm... I tried this and received the following error:

Database error in vBulletin 3.0.3:

Invalid SQL: SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "links WHERE valid = 0 mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '" . TABLE_PREFIX . "links WHERE valid = 0' at line 1

mysql error number: 1064

Shon
07-23-2004, 01:22 AM
Hmmm... I tried this and received the following error:
Use this instead:

$links = $DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "links WHERE valid = 0");

Brian
07-23-2004, 04:43 PM
Oops, didn't realize that I had single 's in the query. Just updated the post. :)

bezzell
07-23-2004, 11:40 PM
Thanks Shon & Brian - that works!

pdatotaal
08-05-2004, 03:59 AM
Works great..! Mhh Shon like to share your nice table?

Shon
08-05-2004, 08:55 PM
Works great..! Mhh Shon like to share your nice table?
Well, since then I've added Link Posts and Join Requests... I took the join requests part of it out and left the link posts HTML, if you want to you can take it out or I may post the code for it later if nobody releases it or has released it yet....

Template: adv_portal_moderation
<!-- Quick Moderation Block -->

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="187">
<thead>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('moderate')"><img id="collapseimg_moderate" src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_moderate.gif" alt="" border="0" /></a>
<span class="smallfont"><strong>$vba_options[portal_blockbullet] $vbphrase[quick_moderation]</strong></span></td>
</tr>
<thead>
<tbody id="collapseobj_moderate" style="$collapseobj_moderate">
<tr>
<td class="$getbgrow">
<table border="0" cellpadding="3" cellspacing="1" class="tborder" width="100%">

<if condition="$show['threads']">
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=posts">Threads</div>
</td>
<td class="thead" align="center">$threads[count]</td></tr>
</if>
<if condition="$show['posts']">
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=posts#postlist">Posts</div>
</td>
<td class="thead" align="center">$posts[count]</td></tr>
</if>
<if condition="$show['events']">
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=events">Events</div>
</td>
<td class="thead" align="center">$events[count]</td></tr>
</if>
<if condition="$show['attachments']">
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=attachments">Attachments</div>
</td>
<td class="thead" align="center">$attachments[count]</td></tr>
</if>
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$admincpdir/user.php?do=moderate">Users</a></div>
</td>
<td class="thead" align="center">$users[count]</td></tr>
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validate" target="_blank">Links</a></div>
</td>
<td class="thead" align="center">$links[count]</td></tr>
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validateposts" target="_blank">Link Posts</a></div>
</td>
<td class="thead" align="center">$linkposts[count]</td></tr>
</table>

</td>
</tr>
</tbody>
</table>
<br />

<!-- End Quick Moderation Block -->

pdatotaal
08-11-2004, 10:13 PM
Thanks, installed! looks very nice... so far not Link Posts and Join Requests used.. So later will be maybe nice..

Thanks again for sharing!

KW802
12-09-2004, 06:18 PM
Shon, very nice! The only change I did was to change the hard-coded width of "187" to be "100%" instead so that it behaves like the rest of my modules.

Thanks. :cool:

Polo
02-01-2005, 06:11 PM
nice :) thanks Brian

cmiller1014
04-03-2005, 11:06 PM
My quick moderation always shows 1 post needs to be moderated, but there are none. Any ideas?

cmiller1014
04-03-2005, 11:09 PM
Shon,

I used your template and its great! What should I add to moderate.php so that it pulls the number of link posts too? Right now it shows no number there, not even 0.

Thanks!

Well, since then I've added Link Posts and Join Requests... I took the join requests part of it out and left the link posts HTML, if you want to you can take it out or I may post the code for it later if nobody releases it or has released it yet....

Template: adv_portal_moderation
<!-- Quick Moderation Block -->

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="187">
<thead>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('moderate')"><img id="collapseimg_moderate" src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_moderate.gif" alt="" border="0" /></a>
<span class="smallfont"><strong>$vba_options[portal_blockbullet] $vbphrase[quick_moderation]</strong></span></td>
</tr>
<thead>
<tbody id="collapseobj_moderate" style="$collapseobj_moderate">
<tr>
<td class="$getbgrow">
<table border="0" cellpadding="3" cellspacing="1" class="tborder" width="100%">

<if condition="$show['threads']">
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=posts">Threads</div>
</td>
<td class="thead" align="center">$threads[count]</td></tr>
</if>
<if condition="$show['posts']">
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=posts#postlist">Posts</div>
</td>
<td class="thead" align="center">$posts[count]</td></tr>
</if>
<if condition="$show['events']">
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=events">Events</div>
</td>
<td class="thead" align="center">$events[count]</td></tr>
</if>
<if condition="$show['attachments']">
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/moderate.php?do=attachments">Attachments</div>
</td>
<td class="thead" align="center">$attachments[count]</td></tr>
</if>
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$admincpdir/user.php?do=moderate">Users</a></div>
</td>
<td class="thead" align="center">$users[count]</td></tr>
<tr><td class="alt2" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validate" target="_blank">Links</a></div>
</td>
<td class="thead" align="center">$links[count]</td></tr>
<tr><td class="alt1" width="80%">
<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validateposts" target="_blank">Link Posts</a></div>
</td>
<td class="thead" align="center">$linkposts[count]</td></tr>
</table>

</td>
</tr>
</tbody>
</table>
<br />

<!-- End Quick Moderation Block -->

Gary Bolton
09-19-2005, 10:33 PM
For cmps 2 this needs to be changed in Brians first post

Change:


<div><a href="$vboptions[bburl]/$modcpdir/links.php?do=validate" target="_blank">Links</a> ($links[count])</div>

To:


<div><a href="$vboptions[bburl]/$modcpdir/vba_links.php?do=validate" target="_blank">Links</a> ($links[count])</div>



---------------------------

PS: Brian, using the same method, what database entry would I have to add to also display Gallery images that need moderating as well? All I need to know is the database code to add to modules/moderate.php

geoff
02-25-2006, 04:43 AM
I know Im bringing up an old post but it fit...

I tried to add the line to my moderate.php within the modules fodler and got an error

is the new line still that since links has changed?

WarriorFX
03-12-2006, 04:38 PM
I know Im bringing up an old post but it fit...

I tried to add the line to my moderate.php within the modules fodler and got an error

is the new line still that since links has changed?
Try this instead (vb3.5.x w/vBadv CMPS 2.1)...
$links = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "links WHERE valid = 0");

geoff
03-12-2006, 04:56 PM
hell ya!!

that worked out

got one for Gallery by chance?

WarriorFX
03-12-2006, 05:11 PM
hell ya!!

that worked out

got one for Gallery by chance?
I don't know of the Gallery module but make sure your references to "$DB_site->" are "$db->" for vB3.5.x

geoff
03-12-2006, 05:39 PM
ok...ty for that tip.

btw, changing links to gallery did not work for the gallery quick moderation deal...heh..just FYI

absolutepunknet
03-21-2006, 03:20 AM
adv_gallery_images

is what you need to change it too..

guttormson
07-10-2007, 06:11 PM
I use vb 3.6.7 and vb cmps 3 and I get an database error when attempting this hack.

Can this hack be done in my setup?

guttormson
07-11-2007, 01:57 PM
The instant I add the above code it breaks my entire site so I have to remove it ASAP. Maybe this solution has changed since vb 3.6?

Anyone know?

Ramses
04-12-2008, 12:08 PM
Fyi this is still working on 3.7rc1 / cmps 3 / vba links 2.
Add into the moderation.php file:
$links = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "adv_links WHERE valid = 0");
And as Gary Bolton already mentioned above add into the vba_portal_moderation template:
<div><a href="$vboptions[bburl]/$modcpdir/vba_links.php?do=validate" target="_blank">Links</a> ($links[count])</div>

natas
09-11-2008, 05:00 PM
This is not working for VBA Links 3. The template edit is wrong. 3.0 no longer uses vba_links.php

Brian
09-12-2008, 12:33 PM
If you're running v3.0.0 then you should be able to use this for your link:

"$vboptions[vba_links_homeurl]/moderate.php$session[sessionurl_q]"