 | |  | | | Photopost Pro How Do I...? Wondering how to do things in PhotoPost? |
February 16th, 2006, 01:20 PM
|
#1 (permalink)
| | Junior Member Verified Customer
Join Date: Jan 2006
Posts: 7
| Exclude Categories from "Recent Photos" bar
Like the title says, there are a few categories I'd rather not have thumbnailed in the recent photos bar on the main gallery index. I imagine it is somewhere in the display_gallery function of pp-inc.php but I do not know the code to exclude a category from being parsed.
|
| |
February 17th, 2006, 02:55 AM
|
#2 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
You would need to edit the function and place in the queries something like this
AND cat NOT IN (501,503)
|
| |
March 3rd, 2006, 06:30 PM
|
#3 (permalink)
| | Junior Member Verified Customer
Join Date: Dec 2004 Location: So Cal USA
Posts: 10
|
Would you be so kind as to show where I would place the "AND cat NOT IN (501,503)"? Thanks!!
Here's a portion of the code (not sure if I copied enough of it) for your convenience:
function display_gallery($q_switch, $showuser="", $showcat="", $overcol=0, $overnum=0) {
global $Globals, $Style, $ppopen, $ppclose, $link, $cat, $exclude_cat, $si, $CatPerms;
$rcols = ( $overcol == 0 ? $Globals['recentcols'] : $overcol );
$rphotos = ( $overnum == 0 ? $Globals['recentnum'] : $overnum );
$catquery = ""; $cattype = "c";
if ($rcols < 0) $rcols = 4;
if ($rcols > 12) $rcols = 4;
if ($rphotos < 0) $rphotos = 12;
if ($rphotos > 100) $rphotos = 12;
$twidth = intval(100/$rcols);
if ( $cat == "500" ) {
$catname = "{$Globals['pp_lang']['gallery']}";
if ( $si == "" ) {
$catquery = "500";
}
else {
$queryb = "SELECT id,cattype FROM {$Globals['pp_db_prefix']}categories ORDER BY catorder ASC";
$boards = ppmysql_query($queryb, $link);
$cnt=0;
while ( list( $catqid, $cattype ) = mysql_fetch_row($boards) ) {
if ( $cnt == 0 ) {
$cnt=1;
$catquery .= "$catqid";
}
else {
$catquery .= ",$catqid";
}
}
ppmysql_free_result($boards);
}
}
|
| |
March 3rd, 2006, 06:56 PM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
like so Code: Content visible to verified customers only.
|
| |
March 3rd, 2006, 07:41 PM
|
#5 (permalink)
| | Junior Member Verified Customer
Join Date: Dec 2004 Location: So Cal USA
Posts: 10
|
(editing what I wrote originally)
I found the spot where there is similar code, but it's not exactly what you posted. Here's what I have:
default:
if ( !isset($cat) || empty($catquery) ) {
$group_title = "{$Globals['pp_lang']['random']}";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' $exclude_cat ORDER BY rand_col DESC";
break;
}
else {
$group_title = "{$Globals['pp_lang']['random']} - $catname";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' $userq $exclude_cat AND cat in ($catquery) ORDER BY rand_col DESC";
-----------------------
There's no 'LIMIT $grabnum";' stuff - so I'm not sure where to put the code you gave.
Sorry - I'm (obviously) not good with code and do REALLY appreciate your time!
Last edited by cwallace; March 3rd, 2006 at 08:09 PM.
|
| |
March 3rd, 2006, 08:11 PM
|
#6 (permalink)
| | Junior Member Verified Customer
Join Date: Dec 2004 Location: So Cal USA
Posts: 10
|
Oh, would I have to add the code (to exclude cats) to the default, most_views and recent sections if I want to exclude certain categories from all those views? I'm guessing yes...
|
| |
March 3rd, 2006, 09:16 PM
|
#7 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
Yes put it in whatever query your using. You replace the 501 and 503 etc with cats you want to exclude.
|
| |
March 3rd, 2006, 09:34 PM
|
#8 (permalink)
| | Junior Member Verified Customer
Join Date: Dec 2004 Location: So Cal USA
Posts: 10
|
I think you missed my post previous to the one you answered.
There's no 'LIMIT $grabnum";' stuff - so I'm not sure where to put the code you gave.
My code isn't exactly the same as yours and I don't want to screw something up. I did make a backup of the file, but still....
|
| |
March 3rd, 2006, 09:42 PM
|
#9 (permalink)
| | Junior Member Verified Customer
Join Date: Dec 2004 Location: So Cal USA
Posts: 10
|
Never mind!  I just decided to go for it and stuck the code before the word ORDER and it did the trick! Thanks!
|
| |
May 17th, 2006, 12:50 PM
|
#10 (permalink)
| | Senior Member Verified Customer
Join Date: Mar 2006 Location: Yorkshire
Posts: 603
|
Cool nice one, stops the more risque photos from being shown on the front page |
| |
May 23rd, 2006, 06:24 AM
|
#11 (permalink)
| | Member Verified Customer
Join Date: Sep 2002 Location: Long Beach, CA
Posts: 156
|
I used this to omit same picture uploaded to different size wallpaper categories. Very useful. Once I figured out the actual code change from the above posts, managed to make the change without too much trouble.
It would be really nice to see something like this built into the Admin options in the next release. ie: cats to omit for each of the special code blocks like recent, random. most popular, etc.
|
| |
June 28th, 2006, 11:59 AM
|
#12 (permalink)
| | Member
Join Date: Jan 2005 Location: Norway
Posts: 56
|
I used this on my recent block, and it worked perfect. I also tried to do it on my random block, but I couldn't get it to work there. Where do I add the piece of code for make it work for my random block? TIA! |
| |
June 28th, 2006, 02:44 PM
|
#13 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
It works in the random block as well if you add it to the query for random as well.
|
| |
October 7th, 2006, 08:01 PM
|
#14 (permalink)
| | Member Verified Customer
Join Date: Jul 2005 Location: Australia, mate
Posts: 46
|
Can anyone help out a lamer where to change this code? This would be a really good feature to have built into the program itself.
|
| |
October 7th, 2006, 08:32 PM
|
#15 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
this post explicitly shows in bold the code you add in the queries in display_gallery function in pp-inc.php to exclude certain cats Exclude Categories from "Recent Photos" bar |
| |
November 14th, 2006, 04:40 PM
|
#16 (permalink)
| | Member Verified Customer
Join Date: Feb 2003
Posts: 81
|
Thanks.. worked!
|
| |
February 11th, 2007, 11:26 PM
|
#17 (permalink)
| | Junior Member Verified Customer
Join Date: Feb 2007 Location: Delaware
Posts: 18
| Help Please
Chuck
I have tried to make this change but to no avail. I have edited the pp-inc.php file, function function display_gallery. I have modified each $query, one at a time, all at once, every combination I could think of. I can not get this to work, I followed the suggested change just replaced the 501,502 with 528 which is the cat that I do now want to show in Recent Photos. This is the line that I was using:
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat NOT IN (528) ORDER BY rand_col DESC LIMIT $grabnum";
So what am I doing wrong?
Greg
|
| |
February 12th, 2007, 10:21 AM
|
#18 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
Have you edited every query in the display_gallery function?
You can also try this Code: Content visible to verified customers only.
|
| |
February 12th, 2007, 11:38 AM
|
#19 (permalink)
| | Junior Member Verified Customer
Join Date: Feb 2007 Location: Delaware
Posts: 18
|
Chuck
I am sure its maybe the way I am formating the line, however it still does not work. I have changed every occurrence I could find in that function. Here is what I have done:
function display_gallery($q_switch, $showuser="", $showcat="", $overcol=0, $overnum=0, $ispal=0) {
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 AND storecat=0 ORDER BY date DESC LIMIT $grabnum";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 AND storecat=0 $userq $catquery ORDER BY date DESC LIMIT $grabnum";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 AND storecat=0 ORDER BY views DESC LIMIT $grabnum";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 AND storecat=0
$userq $catquery ORDER BY views DESC LIMIT $grabnum";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 ORDER BY rand_col DESC LIMIT $grabnum";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved=1 AND cat != 528 $userq $catquery ORDER BY rand_col DESC LIMIT $grabnum";
|
| |
February 12th, 2007, 12:43 PM
|
#20 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,699
|
Those queries work fine and photos from category 528 will not be pulled
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 08:18 PM. | |