I'm posting the complet code for the block below just in case someone here can figure out how to make this work with a seperate photopost database. Hope you zoints guys don't mind, but this is my only hope of getting this working. I don't know enough about mysql to do it myself.
I'm also running Photopost 6.1, so this block probably hase more problems than just the database issue
===================Block code below =========================================
# photopost album
# 1.0.2
# mtgmaster (themtgmaster@gmail.com)
#
http://lol.zoints.com/
#
# Displays a members photos
class user_photopost_album extends z_module
{
# Set the maximum amount of images any users are allowed to display
var $max_images = 7;
# Set your photopost db table prefix here
var $pp_prefix = 'pp_';
# Set your full url to the photopost directory, with no trailing slash
var $pp_dir = 'http://www.majorleaguetalk.com/photopost';
# Set categories you don't want to be displayed, separated with commas eg. '2,500,501'
var $dis_cats = '';
function contents()
{
$content = $this->content;
$vbulletin = $this->_zoints->external->vbulletin;
$userinfo = $this->_zoints->external->load_user($this->zuser);
# If limit hasnt been set or is over the admin set maximum, set it to the admin max
if(empty($content['max_pics']) OR $content['max_pics'] > $this->max_images)
{
$limit_sql = 'LIMIT ' . $this->max_images;
}
# Otherwise, let them set it
else
{
$limit_sql = 'LIMIT ' . $content['max_pics'];
}
# Generate the sql to get rid of some cateories
if(!empty($this->dis_cats))
{
$categories = explode(',', $this->dis_cats);
if(is_array($categories))
{
foreach($categories as $cat)
{
$cat_sql .= 'AND cat<>' . $cat . ' ';
}
}
else
{
$cat_sql = ' AND cat<>' . $this->dis_cats . ' ';
}
}
# Get all photos the user has
$sql = "
SELECT * FROM " . $this->pp_prefix . "photos
WHERE userid=" . $this->zuser . "
AND approved=1
" . $cat_sql . "
ORDER BY date DESC
" . $limit_sql . "
";
$getphotos = $vbulletin->db->query_read($sql);
$html .= '<div class="' . $this->style['pmain1'] . '" style="padding: 0;">';
# Does the user have any photos?
if ($vbulletin->db->num_rows($getphotos))
{
# Display the top of the table
$html .= '<table border="0" width="100%">
<tr>
<td width="100" align="center" class="phead">
Image
</td>';
# Display the details?
if(!$content['details'])
{
$html .= ' <td class="phead">
Details
</td>';
}
$html .= ' </tr>';
# loop and display all that have been fetched from the DB
while($photo = $vbulletin->db->fetch_array($getphotos))
{
# Display image cell
$html .= '
<tr>
<td width="100" align="center" class="' . $this->style['pmain1'] . '">
<a href="' . $this->pp_dir . '/showphoto.php?photo=' . $photo['id'] . '">
<img src="' . $this->pp_dir . '/data/' . $photo['cat'] . '/thumbs/' . $photo['bigimage'] . '" />
</a>
</td>';
# Display the image details?
if(!$content['details'])
{
$html .= '
<td class="' . $this->style['pmain1'] . '" valign="top" style="font-size: 80%;">';
# photo name
$html .= '<div><a href="' . $this->pp_dir . '/showphoto.php?photo=' . $photo['id'] . '">' . htmlspecialchars($photo['title']) . '</a></div>';
# File size in KB
$html .= '<div>Filesize: ' . number_format($photo['filesize'] / 1024, 2) . ' KB</div>';
# Date uploaded
$html .= '<div>Date: ' . $this->_zoints->external->date($photo['date'], $this->_zoints->external->get_date_format()) . '</div>';
# Dimensions
$html .= '<div>Dimensions: ' . $photo['width'] . 'x' . $photo['height'] . '</div>';
# Views
$html .= '<div>Views: ' . $photo['views'] . '</div>';
# Rating
$html .= '<div>Rating: ' . $photo['rating'] . '</div>';
$html .= ' </td>';
}
$html .= '</tr>';
}
$html .= '</table>';
$html .= '<div class="' . $this->style['pmain1'] . '" style="text-align: center;">
<a href="' . $this->pp_dir . '/showgallery.php?cat=500&ppuser=' . $this->zuser . '">View all of ' . $userinfo['username'] . '\'s photos</a>
</div>';
}
# Nope, tell them they have none
else
{
$html .= '<div class="' . $this->style['pmain1'] . '" style="text-align: center;">' . $userinfo['username'] . ' doesn\'t have any photos</div>';
}
if($this->powner)
{
$html .= '<div class="' . $this->style['pmain1'] . '" style="text-align: center;">
<a href="' . $this->pp_dir . '/uploadphoto.php">Upload pictures</a>
</div>';
}
$vbulletin->db->free_result($getphotos);
$html .= '</div>';
return $html;
}
function update($content)
{
return $content;
}
function edit()
{
$content = $this->content;
if($content['max_pics'] AND $content['max_pics'] < $this->max_images)
{
$limit = htmlspecialchars($content['max_pics']);
}
else
{
$limit = $this->max_images;
}
$html .= '<div class="pmain1">';
# Disable description checkbox
$html .= 'Disable image details? ';
$html .= '<input type="checkbox" name="mod[content][details]" ' . ($content['details'] ? 'checked="checked"': '') . ' /> <br />';
# Max pictures textbox
$html .= 'Max pictures to display ';
$html .= '<input type="text" name="mod[content][max_pics]" value="' . $limit . '" size="5" /> ';
$html .= '<span style="font-size: 7pt; color: #848484;">(max ' . $this->max_images . ' allowed)</span> ';
$html .= '</div>';
return $html;
}
}