Icy Phoenix


Archived phpBB Topics (Styles, Mods, Support) - FAP CUSTOMIZATION - Restricting Personal Galleries From Being Displayed



newguy78 [ Sat 08 Sep, 2007 14:20 ]
Post subject: FAP CUSTOMIZATION - Restricting Personal Galleries From Being Displayed
Hello, I am using the photo outside pics mod but I'm noticing that personal gallery pics are showing up, but I do not want them to. At one point of time, I was using the smartor portal with kooky's photo album block, which allowed you to restrict personal gallery pics from being displayed. Does anyone know how I can achieve this? Below I have attached the code to the photo album outside pics mod. Thank you

Code: [Hide] [Select]
<?

if(!defined('IN_PHPBB'))
{
define('IN_PHPBB', true);
$phpbb_root_path = './phpbb/'; //set your path
$album_root_path = $phpbb_root_path . 'album_mod/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
}
else
{
$album_root_path = $phpbb_root_path . 'album_mod/';
}


$language = $board_config['default_lang'];

if ( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_album_main.'.$phpEx) )
{
$language = 'english'; // set your default language
}

include($phpbb_root_path . 'language/lang_' . $language . '/lang_album_main.' . $phpEx);


print "<table align=center>";
print "<tr><th align='center' colspan='3'>". $lang['Random_Pics'] ."</th></tr>";
print "<tr>";

for ($i=0;$i<4;$i++) //set number of pictures for the displayed line
{
while ($cat['cat_view_level'] != '-1')
{
$sql = "SELECT pic_id, pic_desc, pic_cat_id FROM ". ALBUM_TABLE ." ORDER BY RAND() LIMIT 1";
$result = $db->sql_query($sql) or die ("SQL Error");
$row = $db->sql_fetchrow($result);
$sql = "SELECT * FROM ". ALBUM_CAT_TABLE ." WHERE cat_id = '". $row['pic_cat_id'] ."'";
$result = $db->sql_query($sql) or die ("SQL Error");
$cat = $db->sql_fetchrow($result);
}
$cat['cat_view_level'] = '0';
print "<td valign='top'><table><tr><td align='center'>" . $row['pic_title'] . "<br /></td></tr><tr><td align='center'><a href='". append_sid($phpbb_root_path ."album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']) ."'><img width='95' height='85' alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . "' class="ima_bottom"></a></td></tr></table></td>";
}

print "</tr>";
print "</table>";

print "<table align=center>";

print "<tr>";

for ($i=0;$i<4;$i++) //set number of pictures for the displayed line
{
while ($cat['cat_view_level'] != '-1')
{
$sql = "SELECT pic_id, pic_desc, pic_cat_id FROM ". ALBUM_TABLE ." ORDER BY RAND() LIMIT 1";
$result = $db->sql_query($sql) or die ("SQL Error");
$row = $db->sql_fetchrow($result);
$sql = "SELECT * FROM ". ALBUM_CAT_TABLE ." WHERE cat_id = '". $row['pic_cat_id'] ."'";
$result = $db->sql_query($sql) or die ("SQL Error");
$cat = $db->sql_fetchrow($result);
}
$cat['cat_view_level'] = '0';
print "<td valign='top'><table><tr><td align='center'>" . $row['pic_title'] . "<br /></td></tr><tr><td align='center'><a href='". append_sid($phpbb_root_path ."album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']) ."'><img width='95' height='85' alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . "' class="ima_bottom"></a></td></tr></table></td>";
}

print "</tr>";
print "</table>";
?>


lefty74 [ Sat 08 Sep, 2007 23:35 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
i just looked at mine and i have

find
$cat['cat_view_level'] = '0';

replace with
$cat['cat_view_level'] = '1';


newguy78 [ Tue 11 Sep, 2007 21:04 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
Thanks for the reply, looks like the personal galleries pics are still showing up.


Artie [ Wed 12 Sep, 2007 02:43 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
I don't make any guarantees, but this may work

FIND
Code: [Hide] [Select]
for ($i=0;$i<4;$i++) //set number of pictures for the displayed line
{
while ($cat['cat_view_level'] != '-1')
{echo $cat['cat_view_level'].' CVL';
$sql = "SELECT pic_id, pic_desc, pic_cat_id FROM ". ALBUM_TABLE ." ORDER BY RAND() LIMIT 1";
$result = $db->sql_query($sql) or die ("SQL Error");
$row = $db->sql_fetchrow($result);
$sql = "SELECT * FROM ". ALBUM_CAT_TABLE ." WHERE cat_id = '". $row['pic_cat_id'] ."'";
$result = $db->sql_query($sql) or die ("SQL Error");
$cat = $db->sql_fetchrow($result);
}
$cat['cat_view_level'] = '0';
print "<td valign='top'><table><tr><td align='center'>" . $row['pic_title'] . "<br /></td></tr><tr><td align='center'><a href='". append_sid($phpbb_root_path ."album_showpage.". $phpEx ."?pic_id=" . $row['pic_id']) ."'><img width='95' height='85' alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.". $phpEx ."?pic_id=" . $row['pic_id'] . "' class="ima_bottom"></a></td></tr></table></td>";
}

REPLACE WITH
Code: [Hide] [Select]
$limit_sql = 4; //set number of pictures for the displayed line

$sql = "SELECT c.*, p.*
FROM " . ALBUM_CAT_TABLE . " AS c
LEFT JOIN " . ALBUM_TABLE . " AS p ON c.cat_id = p.pic_cat_id
WHERE c.cat_user_id = 0 AND c.cat_view_level = -1 AND ( p.pic_approval = 1 OR c.cat_approval = 0 )
ORDER BY RAND() LIMIT $limit_sql";

$result = $db->sql_query($sql) or die ("SQL Error");

while( $row = $db->sql_fetchrow($result) )
{
$randrow[] = $row;
}

for ($i=0;$i<$limit_sql;$i++)
{
print "<td valign='top'><table><tr><td align='center'>" . $randrow[$i]['pic_title'] . "<br /></td></tr><tr><td align='center'><a href='". append_sid($phpbb_root_path ."album_showpage.". $phpEx ."?pic_id=" . $randrow[$i]['pic_id']) ."'><img width='95' height='85' alt='" . $randrow[$i]['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.". $phpEx ."?pic_id=" . $randrow[$i]['pic_id'] . "' class="ima_bottom"></a></td></tr></table></td>";
}


newguy78 [ Sat 15 Sep, 2007 06:46 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
Thank you, I will try your code tomorrow.


newguy78 [ Mon 17 Sep, 2007 17:20 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
Hey, I applied your code, and I noticed that the personal gallery pics don't appear. The only problem is there is a pic description on top the thumbnail, and since I have this code repeated twice (so that I have two rows of 4 pics each) both rows display the same pics instead of them all being random. I have a testing site at www.mysite.a1forums.com/index5.php if you need to see what I'm talking about. Do you know how I can make all the photos random like before, with restricting the personal gallery pics? Also, sometimes if you refresh the screen it will show a broken thumb which leads to a pic that doesn't exist.


Artie [ Wed 19 Sep, 2007 17:49 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
If you don't want the pic title to display just remove this

Code: [Hide] [Select]
<tr><td align='center'>" . $randrow[$i]['pic_title'] . "<br /></td></tr>


Hmmm, don't know what's causing the empty thumbnail.

When I get some free time, I'll try to come up with something that will do what you want.


Artie [ Wed 19 Sep, 2007 19:52 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
Give this a try ....


Code: [Hide] [Select]
if(!defined('IN_PHPBB'))
{
define('IN_PHPBB', true);
$phpbb_root_path = './forum/'; //set your path
$album_root_path = $phpbb_root_path . 'album_mod/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
}
else
{
$album_root_path = $phpbb_root_path . 'album_mod/';
}


$language = $board_config['default_lang'];

if ( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_album_main.'.$phpEx) )
{
$language = 'english'; // set your default language
}

include($phpbb_root_path . 'language/lang_' . $language . '/lang_album_main.' . $phpEx);

//total number of pictures for display is 8 (2 rows of 4)

$sql = "SELECT p.*
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". ALBUM_CAT_TABLE ." AS c ON p.pic_cat_id = c.cat_id
WHERE c.cat_user_id = 0 AND c.cat_view_level = -1 AND ( p.pic_approval = 1 OR c.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT 8";

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query rand pics information', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
$randrow[] = $row;
}

echo '<div align="center">
<table cellpadding="4" cellspacing="0" border="0">
<tr>
<th colspan="4">' . $lang['Random_Pics'] . '</th>
</tr>
<tr>';

for ($i = 0; $i < 8 ; $i++)
{
if ($i == 4){ echo '</tr><tr><td>&nbsp;</td></tr><tr>'; }

echo '<td><div align="center"><a href="' . append_sid($phpbb_root_path ."album_showpage.". $phpEx ."?pic_id=" . $randrow[$i]['pic_id']) . '">
<img src="'. $phpbb_root_path ."album_thumbnail.". $phpEx ."?pic_id=" . $randrow[$i]['pic_id'] .'" border="0" alt="'. $randrow[$i]['pic_desc'] .'" width="95" height="85" class="ima_bottom">
</a></div></td>';

}

echo '</tr></table></div>';


newguy78 [ Sat 22 Sep, 2007 17:40 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
Thank you so very much, I believe your code worked I've refreshed at least 10 times, and don't see any personal gallery pics. Thank you again!


Artie [ Mon 24 Sep, 2007 02:50 ]
Post subject: Re: Restricting Personal Galleries From Being Displayed
You're very welcome




Powered by Icy Phoenix