coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: DangRabbit on December 29, 2006, 06:48:29 AM

Title: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: DangRabbit on December 29, 2006, 06:48:29 AM
I got a link to their Coppermine profile showing up in their SMF profile (nothing to do with cpmFetch) but I also want to get 3 images from that person as well.

If I use this:

$objCpm = new cpm("/photos");
$objCpm->cpm_viewLastAddedMediaFrom(3,1,"owner=Mom");
$objCpm->cpm_close();


It works fine... but that's hardly dynamic (hardcoding the person's username in).

I tried:

$objCpm = new cpm("/photos");
      $objCpm->cpm_viewLastAddedMediaFrom(3,1,"owner= $context['member']['name'] ");
      $objCpm->cpm_close();


And I'm getting an error:

"Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in... .../Profile.template.php on line 259"

I also tried:

$objCpm = new cpm("/photos");
      $objCpm->cpm_viewLastAddedMediaFrom(3,1,'"owner='$context['member']['name']'");
      $objCpm->cpm_close();


and end up this error:

"Parse error: parse error, unexpected T_VARIABLE in .../Profile.template.php on line 259"

Any help would be SOOO appreciated and I might actually send money or gifts ;)
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: DangRabbit on December 29, 2006, 07:24:55 AM
FINALLY... I figured it out. Ya know, it would help if I knew PHP more.

code that finally worked:

$objCpm = new cpm("/photos");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: asterix23 on January 04, 2007, 05:29:53 PM
I have a problem with your code
I'v included it on a test.php page
<?php

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on
include "cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
?>


But I get this error:
Notice: Undefined variable: context in /home/site.com/public_html/galerie/cpmfetch/test.php on line 7

Please help
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: Nibbler on January 04, 2007, 05:31:59 PM
How do you expect it to work on a test page? It needs to be on the SMF profile page.
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: asterix23 on January 04, 2007, 05:43:24 PM
Ok I have added this code
include "galerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();

on Profile.template.php but I get this error
Fatal error: Cannot instantiate non-existent class: cpm in /home/site.com/public_html/smf/Sources/Load.php(1770) : eval()'d code on line 312
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: vuud on January 04, 2007, 06:19:25 PM
Quote from: asterix23 on January 04, 2007, 05:43:24 PM
Ok I have added this code
include "galerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();

on Profile.template.php but I get this error
Fatal error: Cannot instantiate non-existent class: cpm in /home/site.com/public_html/smf/Sources/Load.php(1770) : eval()'d code on line 312

try changing to include_once ...

I think your path is screwy and include_once if I remember correctly fails harder and more apparent.

Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: asterix23 on January 04, 2007, 06:59:09 PM
fixed thanks!
but there are a problem with members who have a different Username and Displayname, maybe you should use $context['member']['id'] instead of $context['member']['name'] ?
Title: Re: Driving Me Nuts - display images from specific USER in SMF Profile
Post by: PirateZipp on September 06, 2007, 03:22:26 AM
Hey.. i  try to set in the code.. but i'm not shure where to set it...

can som 1 tell me a line to set it in? and what file?

thank you :D