Thanks once again Mini - good stuff.
Working in 3.6.4 and PP 5.6.2 (sharing DB and no prefixes on either). I had to modify code a bit. Working code if it helps anyone is:
postbit:
Code:
<if condition="$post['field7'] == 'Yes'">
<a href="/gallery/showgallery.php?cat=500&ppuser=$post[userid]" target="_blank">
<img class="inlineimg" src="$stylevar[imgdir_misc]/gallery.gif" alt="View $post[username]'s Gallery" width="19" height="18" border="0" title="View $post[username]'s Gallery" /></a>
</if>
gallery.php:
Code:
<?
////////////////////////////////////////////
// MAKE SURE YOU EDIT THIS WHERE STATED //
// Then upload to /includes/cron/ //
////////////////////////////////////////////
// Edit - Make sure this is correct
define('FILE_VERSION', '3.6.4'); // this should match install.php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// Edit this line to reflect your database structure
$photo_query=$vbulletin->db->query_read("SELECT userid FROM photos");
while ($inids = $vbulletin->db->fetch_array($photo_query)) {
$posid = $inids[userid];
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."userfield SET field7 = 'Yes' WHERE ".TABLE_PREFIX."userfield.userid = $posid AND ".TABLE_PREFIX ."userfield.field7 != 'Yes'");
}
log_cron_action("gallery task updated", $nextitem);
?>