forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: Nightmaster on February 26, 2014, 11:50:26 am

Title: cpmfetch pOwner_name
Post by: Nightmaster on February 26, 2014, 11:50:26 am
Is it possible to still use cpmfetch functions like {{pOwner_name}}?
Seems like that one is not working, but {{pTitle}}, {{pCaption}} and {{pOwnerId}} are working just fine.

I'm trying to use this in SMF forum - SP block, which currently looks like this:
Code: [Select]
<?php
  
include "../pictures/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("../pictures/cpmfetch/cpmfetch_config.php");

$options = array("subtitle" => 
<strong>{{pTitle}}</strong>  
{{pCaption}} 
<br> from  <a href=index.php?action=profile;u={{pOwnerId}}><strong>{{pOwner_name}}</strong></a><br><hr>"
);


$options2 = array( 

//"noimage" => "",

"cellstyle" => "align='center'",

"subtitle" => 
<strong>{{pTitle}}</strong>  
<br> <hr>
<strong> {{%A}}: </strong> {{%C}}  

<br><hr>"

);

$objCpm->cpm_viewRandomMedia(2,4$options);
...
it's the code that worked well with coppermine 1.4.25, but {{pOwner_name}} doesn't seems to be working on 1.5 version.
Title: Re: cpmfetch pOwner_name
Post by: gmc on February 26, 2014, 08:11:56 pm
The only reference I can find to pOwner_name is in an old format display in cpmFetch which says it is deprecated...
Was cpmFetch upgraded as part of your server move and upgrades??

I'll do some more looking at the code, but want to know what versions to look at..

Greg
Title: Re: cpmfetch pOwner_name
Post by: Nightmaster on February 26, 2014, 08:46:40 pm
Thanks for your answer.
I didn't touched the plugin itself while upgrading.

Here's the heading of the cpmfetch.php file:
Code: [Select]
/**
 * CpmFetch
 *
 * This is a support library to help grab images from a coppermine database and display them on normal php
 * pages outside the coppermine program.
 * This program is free software; you can redistribute it and/or modify     
 * it under the terms of the GNU General Public License as published by     
 * the Free Software Foundation; either version 2 of the License, or         
 * (at your option) any later version.                                       
 * Runs on: Tested on coppermine 1.3.2,
 * HTML: Generates XHTML (as far as I can tell)
 * PHP: Tested on version 4
 * RELEASE VERSION 2.0.0
 *
 * @version $Revision: 1.12 $
 * @package cpmfetch
 */
/**
* cpmfetch_dao is the data access object for cpmfetch.
* @access private
*/
I guess the version from that is relevant, so it's 2.0.0 version, if I'm not wrong.
Title: Re: cpmfetch pOwner_name
Post by: lurkalot on February 26, 2014, 09:08:09 pm
I asked about this yonks ago, but didn't get it resolved unfortunately.  http://forum.coppermine-gallery.net/index.php/topic,65412.msg336985.html#msg336985

owner name and comment count always worked with cpmfetch 2.0.0 and Coppermine 1.4.x but never with Coppermine 1.5.x  I'd still like to have this working actually.
Title: Re: cpmfetch pOwner_name
Post by: Nightmaster on February 26, 2014, 09:21:40 pm
Actually I found interesting code in cpmfetch_dao file:
Code: [Select]
case ('o'): $output .= $row['pOwner_name']; if ("" == $row['pOwner_name']) $didIfail = true;
break;
Trying to find if there's similar replacement for this variable, but I didn't had a luck so far.
Title: Re: cpmfetch pOwner_name
Post by: gmc on February 26, 2014, 09:29:46 pm
Quote
Actually I found interesting code in cpmfetch_dao file:
That's the code I was referring to - if you scroll up will see reference that the function is the 'old' format and deprecated...
Perhaps a way to still use it - but I need to play with it to see...
You can customize the SQL used as far as select fields, etc in cpmFetch config - but of course owner name is not in the pictures table - so has to be joined with users...

Lurkalot - are you using 2.0 or 2.1.1 dev release?  I was thinking of testing with that to see if it was addressed there... A lot of changes made - but never officially released.  I use it for cfimgget support - just never tried this with it.

Greg

Title: Re: Re: cpmfetch pOwner_name
Post by: lurkalot on February 26, 2014, 10:40:45 pm

Lurkalot - are you using 2.0 or 2.1.1 dev release?  I was thinking of testing with that to see if it was addressed there... A lot of changes made - but never officially released.  I use it for cfimgget support - just never tried this with it.

Greg

Greg, I'm using version CPMFetch 2.0.0 as attached to my first post Here (http://forum.coppermine-gallery.net/index.php/topic,65412.msg324838.html#msg324838) Which was modified to work with Coppermine 1.5.x
Title: Re: cpmfetch pOwner_name
Post by: gmc on February 27, 2014, 04:48:54 am
OK... The change from 1.4 to 1.5 was in Coppermine... The owner name field was dropped from the pictures table.
Appears this was defined/populated in 1.3, still defined in 1.4 (though a 1.4 backup of mine had no data in it), and dropped in 1.5 (why we all needed to change line 61 of the cpmfetch install file to remove the reference to p.owner_name to make it work at all with 1.5.

At least one reason for removing was an issue when a users name changed.. The change wasn't reflected in already existing pictures. Since owner_id was already there, a current user name could always be obtained.

To restore the ability to display this info would need changes to cpmfetch... Either adding a join with user table if owner name is needed - or having cpmfetch use a new view that does the join...

I still need to review the 2.1.1 code, but since it needed the same install change as 2.0.0 - I'm expecting the same issue there...