TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 06:55:51 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 57
  • Total: 57

Coppermine link help please.

Started by lurkalot, January 01, 2010, 01:12:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lurkalot

Happy new year to all.  :)

I know this is not a tinyportal problem, but I figure some of you must be using Coppermine gallery in some of your sites. 

Does anyone know how to add a link to the front page of my site that users see when they are logged in.  So clicking on the link, they would be taken straight to their own gallery in Coppermine.  This would need to check user id to make it point to the user's own gallery.   

In other words, a "My Gallery" link like the one in their Coppermine menu.   If yes, does anyone know what the link code would be? Please.  I would like to add this to a block of some kind, or maybe an existing one used already.  Any help on this would be much appreciated.

I tried asking for help over at the coppemine forums, but got the usual unhelpful reply.  :( http://forum.coppermine-gallery.net/index.php/topic,62620.0.html

IchBin

Are your accounts linked between SMF and Coppermine? Can you show me a link of a users profile in SMF and the same profile in your gallery?

lurkalot

Quote from: IchBinâ„¢ on January 01, 2010, 06:25:32 PM
Are your accounts linked between SMF and Coppermine? Can you show me a link of a users profile in SMF and the same profile in your gallery?

IchBin, thanks for at least taking a look for me.   ;)  SMF and Coppermine are bridged, and share the same login details etc.   Coppermine always adds 1000 in front of the SMF user id number   

The profile link in SMF is  http://cameracraniums.com/forum/index.php?action=profile;u=9

Profile link in coppermine, (example)  http://cameracraniums.com/gallery/profile.php?uid=9

User gallery for that member would be  http://cameracraniums.com/gallery/index.php?cat=10009 

IchBin

This can only be in a phpbox type block. A link would look something like this:

global $context;
if ($context['user']['is_logged'])
    echo '<a href="http://cameracraniums.com/gallery/index.php?cat=1000'.$context['user']['id'].'" alt="User Gallery">User Gallery</a>';



This would create a link in your block for only the user to click to see their own gallery.

lurkalot

Ichbin, thank you so much, that works like a dream.  Just tested it in a php block.  :up:

Now Just need to know how to add it along side the link at the bottom of this php block I'm already using on my front page and it'll be sorted.  I'm not good with code at all.


echo '<div id="cpmfetch">';
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";                   
$objCpm = new cpm();
$options = array("imageheight"=>"80","subtitle" => "<center>{{pTitle}} <br> <center> <FONT color=#1A5EFF size=2>Image By</FONT></STRONG> {{pOwner_name}} <br>{{pHits}} Views <center> <FONT color=#3399FF size=2>Comments</FONT></STRONG> {{pComCount}} </center>");
$objCpm->cpm_viewLastAddedMedia(3,4,$options);
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://cameracraniums.com/gallery?action=gallery">View more latest images</a>';
echo '</div>';

IchBin

There shouldn't be any reason you can't add my code right after your code. Unless there's something specific about the way it looks.

lurkalot

Quote from: IchBinâ„¢ on January 02, 2010, 05:48:49 PM
There shouldn't be any reason you can't add my code right after your code. Unless there's something specific about the way it looks.

Blimey this thread is wide at the moment.  Having to scroll to find the reply button.  ;)

Thanks Ichbin.   All was working fine until user id's go into double figures etc.  10001 - 10009 is ok and takes us to the correct galleries.  Go over 10009 to 100010 and it takes us to galleries that don't exist yet.  correct id would be 10010 .  Back to the drawing board ? :(

IchBin

Ah yes. That'll require some thinking. What about if users hit the 3 digit mark? We need to make sure we account for all the situations. I don't know how many users you have on your board, but check what their user gallery is if it's user 100+ if you have more than a 100 users, then check the same for anything after a 1000 if you have that many. This way, we can adjust accordingly for all situations.

lurkalot

Quote from: IchBinâ„¢ on January 02, 2010, 07:12:50 PM
Ah yes. That'll require some thinking. What about if users hit the 3 digit mark? We need to make sure we account for all the situations. I don't know how many users you have on your board, but check what their user gallery is if it's user 100+ if you have more than a 100 users, then check the same for anything after a 1000 if you have that many. This way, we can adjust accordingly for all situations.

Itchbin, thanks again.  User album id's currently stand at cat=10299 so I guess this will grow as time goes by.

lurkalot

Quote from: IchBinâ„¢ on January 02, 2010, 07:12:50 PM
Ah yes. That'll require some thinking. What about if users hit the 3 digit mark? We need to make sure we account for all the situations. I don't know how many users you have on your board, but check what their user gallery is if it's user 100+ if you have more than a 100 users, then check the same for anything after a 1000 if you have that many. This way, we can adjust accordingly for all situations.

Ichbin.  I had a friend take a look at this for me and he's come up with a modified version of the code you gave me.  Seems to be working fine now. I'll post it below in case anyone's interested.

Thanks for the help though, you got it working for me which is just great.   O0



if ($context['user']['is_logged'])
{
$thecat = 10000 + $context['user']['id'];
echo '&nbsp;&bull;&nbsp;
<a href="http://cameracraniums.com/gallery/index.php?cat='. $thecat .'" alt="My Gallery"><u><b>My Gallery</b></u></a>';
}



IchBin

But that doesn't solve the issue if the member has a double or tripple digit member ID. You'r still adding 10000. I thought you only needed 1000 if the member had a double digit ID ?

lurkalot

hmm,  Ichbin, you got me worried now,  lol. 

That said I've had people test it, and right up to 10303 and all seems fine so far.

Before the code was altered, it was fine up to 10009 but 10010 shifted to 100010

IchBin

Oops, I read it wrong. I thought he was concatenating. he's just adding, to the members id. :) Didn't see that. Should be fine.

lurkalot

Quote from: IchBinâ„¢ on January 03, 2010, 11:09:14 PM
Oops, I read it wrong. I thought he was concatenating. he's just adding, to the members id. :) Didn't see that. Should be fine.

Phew, that a relief lol..

Like I said earlier, thanks for giving me the original code. Without that I'd have I wouldn't have got anywhere with this. 

Cheers.  ;)