Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Usergroup settings affecting cpmFetch  (Read 4898 times)

0 Members and 1 Guest are viewing this topic.

joeyhavlock

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Usergroup settings affecting cpmFetch
« 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

« Last Edit: July 22, 2007, 01:11:00 am by Nibbler »
Logged

Nibbler

  • Guest
Re: Usergroup settings affecting cpmFetch
« Reply #1 on: July 22, 2007, 12:12:30 am »

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.

Code: [Select]
$obj->cpm_unlock_private(true);
Post your code if you need help doing that.
Logged

joeyhavlock

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Re: Usergroup settings affecting cpmFetch
« Reply #2 on: July 22, 2007, 12:54:31 am »

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
Logged

joeyhavlock

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Re: Usergroup settings affecting cpmFetch
« Reply #3 on: July 22, 2007, 12:58:23 am »

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
Logged

majay

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Usergroup settings affecting album count in cpmFetch?
« Reply #4 on: July 26, 2007, 04:35:32 pm »

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.
Logged

Nibbler

  • Guest
Re: Usergroup settings affecting cpmFetch
« Reply #5 on: July 27, 2007, 12:36:32 am »

Looks like a bug to me. Modify cpmfetch_dao.php

Code: [Select]
/**
* 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 " "

Code: [Select]
/**
* 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:

Code: [Select]
'cfShowPrivateOnSqlDefault' => ' ',
Which is actually a space, not an empty string.
Logged

majay

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Usergroup settings affecting cpmFetch
« Reply #6 on: July 27, 2007, 02:25:25 pm »

Yes that did the trick! Thanks Nibbler!
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.