![]() |
Show icon if user has Profile Picture
What does this do?
Basically, when viewing a thread, if a user has a Profile Picture, it will show a camera icon (or whatever picture you choose) next to his/her online status icon. For example: https://vborg.vbsupport.ru/attachmen...chmentid=17973 How to do this hack: Download the instructions! Updates! July 1, 2004: I finally got around to re-writting this a bit so that you don't have a query for every post in every thread. However, after you install this, you'll notice that the first time you view a thread there will be a ton of queries. That will happen until we've essentially cached each user's "haspic" status in the user table... meaning that, in the end, this should be a lot nicer than the last version. :) |
Nice idea but this adds a query for every post on the page. If you have 15 posts, the page will show 15 extra queries whether the user has a profile pic or not. You might want to rework the code a bit to have it only add 1 query per page. ;)
|
Yeah, I know -- maybe someone around here will be smart enough to do that. ;)
|
Put it above the loop for the postbit and declare the globals in the loop. ;)
|
Quote:
Will this decrease the queries? If so please show us where, I'd love to use this hack! |
Anyone get this to work right, with just 1 query per page? I'd appreciate the instructions too...
|
Anyone? Pretty please?? ;)
|
I hope someone updates this, as it's an excellent little add-on...
|
I agree.
if 1 query per page = I install lol |
It'd probably be easier to add a field to the user table for this :) That way no extra queries other than when updating the profile picture :)
|
You can do this without any queries whatsoever. There's another hack somewhere that does the same without a query - just add the variable to an existing query.
|
I haven't been able to locate this, any pointers? :(
I'd really like to get this one up. |
I don't know how to do anything with no queries... ? But, I'm no expert. The only way I can think to do this with only one query would be to add a field to the user table, but I didn't want to worry with those who have already uploaded a pic, though it'd certainly be possible. Maybe I'll play around with it a bit.
|
Quote:
|
Please. :)
|
I think I've got it working. :)
|
What did you come up with? :)
If it just adds one query total (or even 0) to each page I'd be thrilled! |
It's included with the user query now -- check it out!
|
Nice one, but let me suggest an optimization (this is how I did it some weeks ago):
In showthread.php FIND PHP Code:
PHP Code:
PHP Code:
PHP Code:
In template postbit FIND PHP Code:
PHP Code:
You also might want to extend this for single post display and PM ;) |
Quote:
|
Yes. Posts is for linear mode, chacheposts is for hybrid and threaded mode.
But I only tested in linear mode so far ... don't know if this does work in other modes. |
Quote:
|
/me clicks install!
|
Quote:
{$mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$ Miguel |
Getting the same problem here... happened right after upgrading to 3.0.5 from 3.0.1.
Edit - just tried the other method posted by Kirby, which seems to do absolutely nothing on Threaded mode (the only mode our forum uses). :ermm: /me begins uninstalling hack. :tired: |
Hmm, I haven't upgraded to 3.0.5 yet (currently 3.0.3) but I don't see why the code I sposted shouldn't work.
Did you modify both queries? |
Quote:
|
Quote:
I added this code to the image link. <if condition="$post['haspic']"><a href="image.php?u=$post[userid]&type=profile"><img src="$stylevar[imgdir_misc]/photo.gif" align="absmiddle" border="0" alt="$post[musername] Has A Photo Click Here To View"></a></if> I would like to add a 100x100 pop up window to show the image, if anyone could help out. |
Sorted.
PHP Code:
|
I was going to install this but when I got to the profile.php, I noticed the code was different.. So I decided to abandon...
I did already run the query though.. What command would I run to reverse that? Or, is there a set of instructions on a fresh install on 3.0.5? Thanks |
Quote:
|
Quote:
LEFT JOIN " . TABLE_PREFIX . "post_parsed AS post_parsed ON(post_parsed.postid = post.postid) exists twice in my showthread.php Should I add LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON(customprofilepic.userid=post.userid) below both instances? Should I remove the queries I already installed? Sorry.. I dont know what the last few posts really meant, so that may answer my question, but not really since I am not sure what you all are talking about.. Thanks |
As already stated here you must edit both queries.
|
Quote:
Thanks |
Ok.. Got it working... Thanks for the help.. I am running 3.0.5 and with Kirby's instructions, all works well...
Although I think I am going to change the code to have the image located in the images directory rather than the root, which is where it must be by your code.. Thanks again |
Well, I just adapted this from the original hack.
You can palce the image whereever you want, just make sure you got the correct path in the IMG-Tag :) |
Quote:
Any way in the popup window version to get the photo to display centered and not left aligned whenever it pops up? Or have it be dynamic so that no matter what size the picture is it will adjust the pop to be that exact size? Just an asthetics idea.. |
Looks like the current versoin you copied out of some vterm window from a shell of some kind... one of the lines is cut off.
Code:
######### OPEN includes/functions_showthread.php ######## [/high] Code:
$mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$ |
Nice Hack, but i became an parse error:
Parse error: parse error, unexpected '$' in /www/htdocs/v*****/includes/functions_showthread.php on line 1421 This is line 1421 $mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$ |
Replace the line:
PHP Code:
PHP Code:
|
All times are GMT. The time now is 04:47 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|