PDA

View Full Version : Featured Photos box within vBulletin forum is empty...


ulitka
December 3rd, 2007, 05:14 PM
I have finished my photopost installation, successfully downloaded some images:
http://www.ulitka.com/photogallery/

also I have activated the Featured Photos followed by:
http://www.photopost.com/forum/showthread.php?t=110527

but Featured Photos box within vBulletin forum is empty...
http://www.ulitka.com/forums/

could you please point me how to get it works..

Chuck S
December 4th, 2007, 10:06 AM
Well is your inc_features.php file a new file from the 6.01 download and not an older one from say 5.6? I know older versions of the file did not show photos from the members gallery and all your photos are in the members gallery. Try using a clean file from the download.

ulitka
December 4th, 2007, 10:55 AM
Yes, I just bought this script two days ago, so indeed the the inc_features.php is the new one, here is the code:


<?php
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////
// This script is part of PhotoPost PHP, a software application by //
// All Enthusiast, Inc. Use of any kind of part or all of this //
// script or modification of this script requires a license from All //
// Enthusiast, Inc. Use or modification of this script without a license //
// constitutes Software Piracy and will result in legal action from All //
// Enthusiast, Inc. All rights reserved. //
// http://www.photopost.com legal@photopost.com //
// Developer: Michael Pierce (http://www.mdpnet.com) //
// //
// PhotoPost Copyright 2007, All Enthusiast, Inc. //
////////////////////////////////////////////////////////////////////////////

require "config-int.php";

// If you have placed PhotoPost into a seperate database, you will need to // uncomment these lines to connect to the PhotoPost database. It is suggested // that you install PP into the same database as vB for better performance.
//
// If you use the same userid/password to access both databases, you don't need to // uncomment the mysql_connect - this is only if you require different ids to access // the PhotoPost database.
//
//$link = mysql_connect ("localhost", "$dbuserid", "$dbuserpassword") or die('I cannot connect to the database.'); //mysql_select_db ("pp_database")or die("Could not select photopost database");

// Number of photos to display
$num_display = 4;

// Number of columns (1 for vertical)
$columns = 4;

// which type of images do you want to show (random, most_view, latest) $q_switch = "random";

// == END CONFIGURATION ==
////////////////////////////////////////////////////////////////////////////

if ( !isset($ViewPerm) )
{
if ( isset($bbuserinfo['usergroupid']) )
{
$mygroups = $bbuserinfo['usergroupid'];

if ( $bbuserinfo['membergroupids'] != "" )
{
$mygroups .= ",".$bbuserinfo['membergroupids'];
}
}
else
{
// vB3.5 uses $vbulletin
$mygroups = $vbulletin->userinfo['usergroupid'];

if ( $vbulletin->userinfo['membergroupids'] != "" )
{
$mygroups .= ",".$vbulletin->userinfo['membergroupids'];
}
}

$grouparr = explode( ",", $mygroups );

$resultb = mysql_query("SELECT id,ugnoview FROM {$pp_db_prefix}categories");
$ViewPerm = array();

while ( list( $catugid, $ugnoview ) = mysql_fetch_row($resultb) )
{
$noview=0;
$ViewPerm[$catugid] = 1;

$allnoview = explode( ",", $ugnoview );

foreach ($allnoview as $key)
{
if (in_array($key, $grouparr) )
{
$noview = 1;
}
}

if ( $noview == 0 )
{
$ViewPerm[$catugid]=0;
}
}
}

function pp_get_ext( $filename )
{
return substr($filename, strrpos($filename,".")); }

function pp_is_image( $filename )
{
$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
{
return( true );
}

return( false );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code //

switch ($q_switch)
{
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.bigimage,p.height,p.width,c.catname,c.photos,c.posts
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id = p.cat
WHERE c.cattype = 'c' AND p.storecat = 0
ORDER BY views DESC";
break;

case "latest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.bigimage,p.height,p.width,c.catname,c.photos,c.posts
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id = p.cat
WHERE c.cattype = 'c' AND p.storecat = 0
ORDER BY date DESC";
break;

default:
$query = "SELECT p.id,p.user,p.userid,p.cat,p.bigimage,p.height,p.width,c.catname,c.photos,c.posts
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id = p.cat
WHERE c.cattype = 'c' AND p.storecat = 0
ORDER BY RAND()"; } $result = mysql_query($query);

$counted = 0;
$countcol = 0;
$featured = null;

while (list($pid,$puser,$puserid,$pcat,$photo,$height,$width,$catname,$cphotos,$cposts) = mysql_fetch_row($result)) {

if ( $ViewPerm[$pcat] == 1 )
{
continue;
}

if ( pp_is_image($photo) )
{
$temp_user = $puserid;

if ( $height > $width )
{
$mthumb = "<img src=\"{$url_path}/images/overlay-roundp.gif\" height=\"105\" width=\"81\" border=\"0\" alt=\"\" />";
}
else
{
$mthumb = "<img src=\"{$url_path}/images/overlay-round.gif\" height=\"81\" width=\"105\" border=\"0\" alt=\"\" />";
}

// One box for each feature
$featured .= <<<PPPRINT
<td align="center" class="alt1">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="background: url({$data_dir}{$pcat}/thumbs/$photo); background-color: #000000; background-repeat: no-repeat; background-position: center;"><a href="{$url_path}/showphoto.php?photo={$pid}">$mthumb</a></td>
</tr>
</table>
<font size="1" face="verdana,arial">by {$puser}<br />
&middot; &middot; &middot;<br />
<a href="{$url_path}/showgallery.php?cat={$pcat}">$catname</a><br />
$cphotos photos<br />$cposts comments<br /></font>
</td>
PPPRINT;

$counted++;
$countcol++;
}

// If we've reached our limit, quit
if ( $counted == $num_display )
{
break;
}

// If we need to end the column, do so.
if ( $countcol == $columns )
{
$featured .= <<<PPPRINT
</tr>
<tr>
PPPRINT;

$countcol = 0;
}
}
@mysql_free_result($result);


// First part is for the featured photos // $photopostfeature not holds the Featured Photos box and $photopostcats (set below) holds the // gallery list

$photopostfeature = <<<PPPRINT
<table class="tborder" cellpadding="0" cellspacing="0" border="0" width="100%" align="center"> <tr> <td>
<table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%">
<thead>
<tr>
<td class="tcat" colspan="$columns" align="center">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('featurepal');"><img id="collapseimg_featurepal" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_featurepal].gif" alt="" border="0" /></a>
Featured Photos
</td>
</tr>
</thead>
<tbody id="collapseobj_featurepal" style="$vbcollapse[collapseobj_featurepal]">
<tr>
$featured
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<br />

PPPRINT;

//
// End Featured Photos Code
//

// If you use PhotoPost in a seperate database from vB, you'll need to reselect the vB database!
//mysql_select_db ("vb_database");

?>



thank you for looking into this

Chuck S
December 4th, 2007, 12:03 PM
Oh your issue is easy. You have no photos uploaded to any categories all you have uploaded is photos to personal albums which are not shown in that photo block.

ulitka
December 4th, 2007, 12:28 PM
Is it possible to show photos from personal user's albums in featured photos box? Because 99% of photos (in my case) are comes from users.. :confused:

Chuck S
December 4th, 2007, 03:42 PM
Well we support the default coding of the product but you may try editing the inc_features.php file and delete the code in bold from every query line and see if this helps you.


WHERE c.cattype = 'c' AND p.storecat = 0



anotherwards those lines would look like this after the edit.


WHERE p.storecat = 0

ulitka
December 4th, 2007, 04:57 PM
Nice!
It's works.
Thank you!

Chuck S
December 4th, 2007, 05:11 PM
Have a good evening.