PDA

View Full Version : Latest Photopost Photo In Postbit


sabret00the
11-29-2004, 10:00 PM
Ok so i'm in the middle of developing something cool and it seems that a few people actually only want half of what i'm attempting to do so for you all here you go. Peace, Love and Happiness!

Damn almost forgot the desciption, erm this hack puts a photo, but not just any photo, your last uploaded photo into your postbit, it's s3x11111!!!!! i think :o.

Ok theirs one question i don't ever ever ever want to see in this thread, unless you're sure you have www.photopost.com's photopost installed, save us all the heartache and just don't do it, be kind, be generous, show me love, but if you aint got photopost installed then what's the point in saying "it don't show the photo for me" it's bound not to :( oh and for people who are going to ask "can you do it for the vB photo" nope i'm afraid i've never tried :(

ok after that little bit i should say something cool, like screenshots are not present since i have no desire to install this as is, no wait that sucked, however if anyone would like to provide screenies, you're welcome yay.

Damn is their nothing else i can waste your time with, surely you have no better to do than read my garbage, guess not, oh well it's an easy installation, i estimates 3.75 minutes, 2 files edits, one template mod, 1 vB option group and a setting to fill it.

big thanks to natch without him it would've been impossible and thanks to dean c (mist) too who got me through the final stages like a lucazade during a marathon.

* sabret00the does cool guy pose

have fun with it. :p :)

Query Load: beleive it or not, from the dungeon of super sucky coders this came and only adds one query to the showthread, i'm not even lying, wow, well that's what the microstats said, so if i was wrong blame Neo, he's obviously misalligned the matrix.

think i covered everything now :)

in your includes/functions_showthread.php find
// ###################### Start process_highlight_postbit #######################
function process_highlight_postbit($text, $words, $prepend)


above that add
// ###################### Start last photopost photo #######################
function fetch_galleryavatarcache()
{
global $DB_site, $galleryavatarcache;
if (!is_array($galleryavatarcache))
{
$galleryavatarcache = array();
$allgalleryavatars = $DB_site->query("
SELECT pp_photos.id, pp_photos.title, user.userid, pp_photos.cat, pp_photos.approved, pp_photos.bigimage
FROM ppost_photos AS pp_photos
LEFT JOIN " . TABLE_PREFIX ."user AS user ON pp_photos.userid = user.userid
");

while($galleryavatararray = $DB_site->fetch_array($allgalleryavatars))
{
$galleryavatarcache["$galleryavatararray[userid]"] = $galleryavatararray;
}

$DB_site->free_result($allgalleryavatars);
}
}

function fetch_cachedgalleryavatar_url($userid)
{
global $galleryavatarcache, $vboptions, $stylevar;
if(!is_array($galleryavatarcache))
{
fetch_galleryavatarcache();
}
if($galleryavatarinfo = $galleryavatarcache[$userid])
{
if ($galleryavatarinfo[bigimage] && $galleryavatarinfo[cat])
{
return "$vboptions[galleryurl]/data/$galleryavatarinfo[cat]/{$userid}".substr($galleryavatarinfo[bigimage], 0, -4)."-thumb.".file_extension($galleryavatarinfo[bigimage]);
}
else
{
return "$stylevar[imgdir_misc]/noavatar.gif";
}
}
return FALSE;
}

now in your showthread.php find
$post['musername'] = fetch_musername($post);
$post['islastshown'] = ($post['postid'] == $lastpostid);
$post['attachments'] = &$postattach["$post[postid]"];

and directly below that add:
$post['galleryavatar'] = fetch_cachedgalleryavatar_url($post[userid]);


now chuck your board into debug mode and add this setting group:
vaname: photopost
title: Photopost
vB default: no

now add to that group this option

varname: galleryurl
title: Gallery URL
Description: this is the location to your photopost installation (no trailing backslash)
Option: [leave this blank]
Default: http://www.domainname.com/directory
vB default: no

now in your postbit template, whereever you want it add
<if condition="$post[galleryavatar]"><a href="$vboption[galleryurl]/showgallery.php?cat=500&ppuser=$post[userid]"><img src="$post[galleryavatar]" border="0" alt="$post[username]'s latest photo" /></a></if>

hdraye
11-30-2004, 01:35 PM
Thanx

But what do you mean here?
============================

now chuck your board into debug mode and add this setting group:
======================================

sabret00the
11-30-2004, 01:40 PM
check this thread it goes through many ways of turning on debug mode on your forums
https://vborg.vbsupport.ru/showpost.php?p=300715&postcount=1 bar that, it's just a matter of adding $debug = 1; to the top of your config.php

hdraye
11-30-2004, 01:50 PM
Sorry, but do I have to have pp tables under VB database? I have separate bases and I get an error that tabel "forum" does not exist

I forgot the message but I had to uninstall as no one can access the VB because of the error

Thanx again

Hani

KTBleeding
11-30-2004, 01:50 PM
Sounds very interesting. Does the image link to the users galleries too? And... I'm curious as to what the full version of this hack is going to be. ;)

hdraye
11-30-2004, 01:55 PM
well, I meant adding the setting group, not the debug :( as it is mentioned/not mentioned in the manual

I appreciate your help

Thanx again and again

Hani

sabret00the
11-30-2004, 02:18 PM
Sorry, but do I have to have pp tables under VB database? I have separate bases and I get an error that tabel "forum" does not exist

I forgot the message but I had to uninstall as no one can access the VB because of the error

Thanx again

Hani
yes you do need em in the same database.

also in the query theirs the line FROM ppost_photos make sure that matches your photopost table prefix so you'd change it from ppost_ to photopost_ or whatever.

sabret00the
11-30-2004, 02:19 PM
Sounds very interesting. Does the image link to the users galleries too? And... I'm curious as to what the full version of this hack is going to be. ;)
yes it does link to the users gallery, the full version isn't that spectacular, it's just the ability to have the latest photopost picture (thumbnail) as your avatar.

sabret00the
11-30-2004, 02:21 PM
well, I meant adding the setting group, not the debug :( as it is mentioned/not mentioned in the manual

I appreciate your help

Thanx again and again

Hani
once your board is in debug mode, go to the main options screen
http://yourdomain.com/forums/admincp/options.php?null=0
and you'll see an option to add a new settings group.

hdraye
11-30-2004, 02:35 PM
well, as the PP base must be the same as VB base, then this is not for me :(

kevinrstruck
11-30-2004, 04:32 PM
I had to uninstall also since I use a PhotoPost database also. Bummer!

alkatraz
11-30-2004, 07:00 PM
I use a PhotoPost database also
ditto =(

Sounds like a great hack, screenshots would be nice.
I plan to use it with classified post instead, putting the members last ad in their post, linking to their personal ads. (only for upgraded members tho hehe)

If anyone knows how to get this working on a seperate db, please post up. I'm sure it can't be too rough. I'd be willing to spend some time on it, but I'm no programer.

cinq
11-30-2004, 11:38 PM
We want screenies ! :D:p

SVTBlackLight01
11-30-2004, 11:48 PM
I had to uninstall also since I use a PhotoPost database also. Bummer!

This is probably the case for most people, me included.

Jolten
12-01-2004, 04:21 AM
Can I get a text file please?

sabret00the
12-01-2004, 09:10 AM
We want screenies ! :D:p
done

sabret00the
12-01-2004, 09:11 AM
Can I get a text file please?
in all honesty i wrote it into the thread on the fly, it'd be just as much effort for me to make it as it would be for you to copy and paste it, but alas, i'll see what i can do this afternoon :)

MPDev
12-01-2004, 11:44 AM
Actually, if they are in seperate databases, as long as they share a common userid/password for access, you could just use the query:

SELECT pp_photos.id, pp_photos.title, user.userid, pp_photos.cat, pp_photos.approved, pp_photos.bigimage
FROM ppost_photos AS pp_photos
LEFT JOIN " . TABLE_PREFIX ."user AS user ON pp_photos.userid = user.userid

and add in a tablename before the ppost_photos like:

photopostdb.ppost_photos

Then it would pull it from the other database without having to switch or combine dbs.

sabret00the
12-01-2004, 12:12 PM
nice one michael :) hopefully it helps a few people.

cinq
12-01-2004, 02:25 PM
Hmm I think I will try to develop some album drop down too if the user has an album, i never got round to finishing that hack.

Nice hack btw sabre :D

sabret00the
12-01-2004, 02:56 PM
thanks :)

snyx
12-01-2004, 03:51 PM
Oh please make a recent photos in Forumhome hack :)

sabret00the
12-01-2004, 04:11 PM
i already got that, but i got it from www.photopostdev.com and just converted it to vBulletin.

alkatraz
12-01-2004, 10:24 PM
Actually, if they are in seperate databases, as long as they share a common userid/password for access, you could just use the query:

SELECT pp_photos.id, pp_photos.title, user.userid, pp_photos.cat, pp_photos.approved, pp_photos.bigimage
FROM ppost_photos AS pp_photos
LEFT JOIN " . TABLE_PREFIX ."user AS user ON pp_photos.userid = user.userid

and add in a tablename before the ppost_photos like:

photopostdb.ppost_photos

Then it would pull it from the other database without having to switch or combine dbs.
woot thx!

will play around with this later

SVTBlackLight01
12-02-2004, 12:34 AM
Actually, if they are in seperate databases, as long as they share a common userid/password for access, you could just use the query:

SELECT pp_photos.id, pp_photos.title, user.userid, pp_photos.cat, pp_photos.approved, pp_photos.bigimage
FROM ppost_photos AS pp_photos
LEFT JOIN " . TABLE_PREFIX ."user AS user ON pp_photos.userid = user.userid

and add in a tablename before the ppost_photos like:

photopostdb.ppost_photos

Then it would pull it from the other database without having to switch or combine dbs.

Thanks for the tip. I got it working, but for some reason the image is broken for just one member (that I have been able to see so far). The path isn't correct. It should be http://www.modernengineuity.com/gallery/data/500/468108_0841-thumb.JPG, but it's trying to find it in http://www.modernengineuity.com/gallery/data/503/468108_0841-thumb.JPG

Any ideas? :confused:

Intex
12-02-2004, 04:57 AM
Nice work sabret00the . Do you have any plans to release a vBadvanced CMPS module to show the last photo on the homepage? I think a lot of people would be interested in that.

sabret00the
12-02-2004, 10:17 AM
Nice work sabret00the . Do you have any plans to release a vBadvanced CMPS module to show the last photo on the homepage? I think a lot of people would be interested in that.
i don't use vBaCMPS but i think it's already been done anyway :)

sabret00the
12-02-2004, 10:18 AM
Thanks for the tip. I got it working, but for some reason the image is broken for just one member (that I have been able to see so far). The path isn't correct. It should be http://www.modernengineuity.com/gallery/data/500/468108_0841-thumb.JPG, but it's trying to find it in http://www.modernengineuity.com/gallery/data/503/468108_0841-thumb.JPG

Any ideas? :confused:
i haven't got a clue, i can only recommend checking the database and seeing what the catid is for that user for the latest piccie.

dutchbb
12-02-2004, 10:50 AM
this could be good, if members have the option to turn it off. I would also like it to be set off by default and only show avatar OR PP pic, not both.

sabret00the
12-02-2004, 10:55 AM
this could be good, if members have the option to turn it off. I would also like it to be set off by default and only show avatar OR PP pic, not both.
that's exactly what i want from this, however i just gotta get to grips with the useroptions and usergroup settings.

sabret00the
12-02-2004, 11:34 AM
this could be good, if members have the option to turn it off. I would also like it to be set off by default and only show avatar OR PP pic, not both.
just thinking you could do it with a useroption and a conditional, it's how i was gonna do it, but my problem is that i want it to only be available to certain usergroups hence why i need to learn the additional hacking.

cinq
12-02-2004, 01:47 PM
If i wanted to include the latest 3 photos in the postbit, how is that possible ?
I know the code would have to changed somewhat.

Any help ? :)

sabret00the
12-02-2004, 01:58 PM
it's not possible with the above code :(

cinq
12-02-2004, 02:35 PM
Yep, but do you know how it can be done ?
( might want to take this to PM, don't want to mix things up with the current hack :) )

sabret00the
12-02-2004, 02:48 PM
the only way i could think of would be to just add the hack twice more i.e. changing the query to get the row beyond the previous one, but that's adds two extra queries to the thread.

SVTBlackLight01
12-05-2004, 08:06 PM
i haven't got a clue, i can only recommend checking the database and seeing what the catid is for that user for the latest piccie.
I was hoping MPDev would have a suggestion, but it seems to be related to choosing additional categories during upload to PhotoPost.

SVTBlackLight01
12-16-2004, 06:40 PM
This won't work if the last upload is a multimedia file that doesn't have a thumbnail.

sabret00the
12-16-2004, 07:18 PM
add a conditional in order to check the extention is either .jpg or .gif and it aint then return "multimedia_image.gif" or something

merseybeat
01-19-2005, 12:20 PM
Anyone got any idea on handling multimedia files for this mod?

Eddie

SVTBlackLight01
01-20-2005, 01:52 AM
Anyone got any idea on handling multimedia files for this mod?

Eddie
I'm still working on a way to do this.


Images in private albums are displayed with this hack as well.

kall
02-27-2005, 07:44 AM
Just a heads-up, this seems not to work with PhotoPost 5.

Things have changed, file-storage wise.

hdraye
09-18-2005, 04:32 PM
Hi people
Any updates here?

regards

T3MEDIA
12-01-2005, 10:38 PM
add a conditional in order to check the extention is either .jpg or .gif and it aint then return "multimedia_image.gif" or somethingSaber does this work with photopost 5?

sabret00the
12-01-2005, 10:41 PM
Saber does this work with photopost 5?

i don't think it does.