coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: nickfzx on July 02, 2007, 03:36:11 PM

Title: problem with new favs feature
Post by: nickfzx on July 02, 2007, 03:36:11 PM
When using the new favorites feature I have encountered a problem.

If you specify a username of a member who has no favorites the parameter is ignored completely

so if i do this:
$objCpm->cpm_viewLastAddedMediaFrom("favorites=4",5,1,$options2);
and user with id 4 has no favorite images then it is completely ignored and just becomes a lastAddedMediaFrom and images are shown that aren't favorite's of anyone.

what I would prefer is if it returns no images at all if user id 4 has no favorites.

this is the case with the category selection i think...if you select a category with no images in then no images are shown.

thanks for your help...cpmfetch rules  ;D
Title: Re: problem with new favs feature
Post by: vuud on July 02, 2007, 07:18:25 PM
Quote from: nickfzx on July 02, 2007, 03:36:11 PM
When using the new favorites feature I have encountered a problem.

If you specify a username of a member who has no favorites the parameter is ignored completely

so if i do this:
$objCpm->cpm_viewLastAddedMediaFrom("favorites=4",5,1,$options2);
and user with id 4 has no favorite images then it is completely ignored and just becomes a lastAddedMediaFrom and images are shown that aren't favorite's of anyone.

what I would prefer is if it returns no images at all if user id 4 has no favorites.

this is the case with the category selection i think...if you select a category with no images in then no images are shown.

thanks for your help...cpmfetch rules  ;D

Hmmm, yeah - your suggestion makes sense.  Lemme check it tonight...


Title: Re: problem with new favs feature
Post by: nickfzx on July 29, 2007, 05:31:56 PM
hey vuud...just wandering if you got round to fixing this in the end?

If not I will just fix it myself as I am going to need it to be working in around a week.
Title: Re: problem with new favs feature
Post by: nickfzx on August 12, 2007, 03:04:51 AM
I fixed this now, let me know if you want the code i changed  :)
Title: Re: problem with new favs feature
Post by: Joachim Müller on August 12, 2007, 09:35:35 AM
No question. Please don't wait for others to ask for the code - just contribute it here.
Title: Re: problem with new favs feature
Post by: vuud on August 12, 2007, 03:06:01 PM
Quote from: nickfzx on August 12, 2007, 03:04:51 AM
I fixed this now, let me know if you want the code i changed  :)

Yeah definately!

Title: Re: problem with new favs feature
Post by: nickfzx on August 12, 2007, 03:10:47 PM
open cpmfetch_dao.php

find:
if (sizeof($pidlist)) {
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}

replace with:
if (sizeof($pidlist)) {
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}
else{
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}


that should do it.

There is another problem that I'm having with this feature that I'll post in a new topic
Title: Re: problem with new favs feature
Post by: vuud on August 14, 2007, 05:40:36 PM
Quote from: nickfzx on August 12, 2007, 03:10:47 PM
open cpmfetch_dao.php

find:
if (sizeof($pidlist)) {
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}

replace with:
if (sizeof($pidlist)) {
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}
else{
$sourceSql .= " p.pid IN ('" . implode("','", $pidlist) . "') OR ";
}


that should do it.

There is another problem that I'm having with this feature that I'll post in a new topic

What makes it different?  The if/else runs the exact same code... 

Vuud

Title: Re: problem with new favs feature
Post by: nickfzx on August 16, 2007, 12:35:48 AM
yep...but without the else bit it would ignore the favorites bit altogether and just show the last uploaded images...that is if the user had no images in their favorites.
Title: Re: problem with new favs feature
Post by: vuud on August 22, 2007, 10:03:25 PM
Quote from: nickfzx on August 16, 2007, 12:35:48 AM
yep...but without the else bit it would ignore the favorites bit altogether and just show the last uploaded images...that is if the user had no images in their favorites.

If you are going to have the same code in the if as you do in the else, you mind as well just remove the if...

I think - I am pretty burned out right now, that guy with that took the shotgun to the internet has caused me to have an interesting week.

Title: Re: problem with new favs feature
Post by: nickfzx on August 28, 2007, 12:44:15 PM
yes that would probably make sense :)