forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: joeyhavlock on July 21, 2007, 11:58:13 pm
-
Hi Vuud and All,
I have cpmFetch working beautifully, but...
For images in cats/albums that require a usergroup membership, cpmFetch returns no images
For example I have some adult images in coppermine and it requires adult usergroup access to view
When I load cpmFetch on a page trying to look at those images, I get a nothing returned, just blank, no images even if the person viewing is in the usergroup or even me as administrator
Is there somewhere I can override this?
Thanks much
Joey
-
I think the cpm_unlock_private option is what you are looking for (but that will make them visible to everyone). Call that before you retrieve the images.
$obj->cpm_unlock_private(true);
Post your code if you need help doing that.
-
Thanks for the reply
I tried it, but got an error.
Here's my code:
<?php
include_once "../../coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../../coppermine/cpmfetch/cpmfetch_config-adult.php");
$options = array("windowtarget" => "_top");
$objCpm->cpm_viewRandomMediaFrom("Cat=5",1, 6, $options);
$objCpm->cpm_close();
?>
</div>
Where would I put this code you are referring to:
$obj->cpm_unlock_private(true);
if I put it in my code above, I get an error;
Fatal error: Call to a member function on a non-object in /home/content/m/u/s/museumcurator/html/community/fetch/coppermine-adult-mod1.php on line 16
Do I put this in the config file or the fetch file?
Thanks again
Joey
-
Sorry, knee jerk response...
It worked! Thanks so much! The code should have the 'Cpm' after the obj though, like below.
It's ok about everyone having access as inorder to get to the page where this is displayed you have to have the adult access priveledge anyway, so its perfect.
$obj->cpm_unlock_private(true);
should be;
$objCpm->cpm_unlock_private(true);
Thanks much Bud!
Joey
-
Hi,
I have a related issue with the album count. Despite cpm_unlock_private being set to (true), which displays the total image and view count for the entire gallery (public and private) perfectly well, for some reason it won't show the total number of albums, only the public ones are taken into account. Can something else be added so that usergroup settings are overriden in albums too?
Thank you.
-
Looks like a bug to me. Modify cpmfetch_dao.php
/**
* Returns the number of albums in the database.
* @access public
*/
function getAlbumCount( ) {
$sqlcode = "SELECT {$this->sqlPostSelect} COUNT(*) as media_total FROM "
. $this->cfg['table_prefix']
. "albums AS a";
if ($this->privacyfilter != "") {
$sqlcode .= " WHERE a.visibility = 0" ;
}
$result = $this->dbExecuteSql($sqlcode);
return $this->resultArray[0]['media_total'];
}
And change the "" to " "
/**
* Returns the number of albums in the database.
* @access public
*/
function getAlbumCount( ) {
$sqlcode = "SELECT {$this->sqlPostSelect} COUNT(*) as media_total FROM "
. $this->cfg['table_prefix']
. "albums AS a";
if ($this->privacyfilter != " ") {
$sqlcode .= " WHERE a.visibility = 0" ;
}
$result = $this->dbExecuteSql($sqlcode);
return $this->resultArray[0]['media_total'];
}
That way it corresponds to the default value here:
'cfShowPrivateOnSqlDefault' => ' ',
Which is actually a space, not an empty string.
-
Yes that did the trick! Thanks Nibbler!