FAP CUSTOMIZATION - Restricting Personal Galleries From Being Displayed


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: [Download] [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>";
?>

Profile PM  
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';

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
Thanks for the reply, looks like the personal galleries pics are still showing up.

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
I don't make any guarantees, but this may work

FIND
Code: [Download] [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: [Download] [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>";
}

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
Thank you, I will try your code tomorrow.

Profile PM  
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. :?

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
If you don't want the pic title to display just remove this

Code: [Download] [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.

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
Give this a try ....


Code: [Download] [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>';

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
Thank you so very much, I believe your code worked :mryellow: I've refreshed at least 10 times, and don't see any personal gallery pics. Thank you again!

Profile PM  
Subject: Re: Restricting Personal Galleries From Being Displayed
You're very welcome :wink:

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 1.6637s (PHP: 2% SQL: 98%)
SQL queries: 29 - Debug Off - GZIP Enabled