vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Show icon if user has Profile Picture (https://vborg.vbsupport.ru/showthread.php?t=63613)

TechGuy 04-07-2004 10:00 PM

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. :)

Boofo 04-08-2004 09:10 AM

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. ;)

TechGuy 04-08-2004 11:57 AM

Yeah, I know -- maybe someone around here will be smart enough to do that. ;)

Boofo 04-08-2004 11:59 AM

Put it above the loop for the postbit and declare the globals in the loop. ;)

pixelpunk 05-11-2004 07:07 PM

Quote:

Originally Posted by Boofo
Put it above the loop for the postbit and declare the globals in the loop. ;)


Will this decrease the queries? If so please show us where, I'd love to use this hack!

Alien 06-05-2004 11:39 PM

Anyone get this to work right, with just 1 query per page? I'd appreciate the instructions too...

FutureDEV 06-08-2004 01:47 PM

Anyone? Pretty please?? ;)

Alien 06-12-2004 10:52 PM

I hope someone updates this, as it's an excellent little add-on...

Polo 06-17-2004 09:19 PM

I agree.

if 1 query per page = I install

lol

Dean C 06-17-2004 10:35 PM

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 :)

Erwin 06-17-2004 11:49 PM

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.

Alien 06-18-2004 10:38 AM

I haven't been able to locate this, any pointers? :(

I'd really like to get this one up.

TechGuy 06-23-2004 12:29 PM

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.

Polo 06-23-2004 12:45 PM

Quote:

Originally Posted by Erwin
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.

can you give us the link? :ermm: :squareeyed: :rolleyes: :)

Alien 06-29-2004 07:47 PM

Please. :)

TechGuy 07-01-2004 03:45 AM

I think I've got it working. :)

Alien 07-04-2004 06:47 AM

What did you come up with? :)

If it just adds one query total (or even 0) to each page I'd be thrilled!

TechGuy 07-04-2004 10:15 AM

It's included with the user query now -- check it out!

Andreas 07-04-2004 10:37 AM

Nice one, but let me suggest an optimization (this is how I did it some weeks ago):

In showthread.php FIND
PHP Code:

post_parsed.pagetext_htmlpost_parsed.hasimages

BELOW that ADD
PHP Code:

NOT ISNULL(customprofilepic.userid) AS haspic

Further down in showthread.php FIND
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "post_parsed AS post_parsed ON(post_parsed.postid post.postid

BELOW that ADD
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "customprofilepic  AS customprofilepic ON(customprofilepic.userid=post.userid

And use this template modification:

In template postbit FIND
PHP Code:

$post[onlinestatus

BELOW that ADD
PHP Code:

<if condition="$post['haspic']"><img src="/photo.gif" border=0 alt="Photo in Profile!"></if> 

That's it. This way you don't have to alter table user, file profile.php and functions_showthread.php.
You also might want to extend this for single post display and PM ;)

Boofo 07-04-2004 10:54 AM

Quote:

Originally Posted by KirbyDE
Nice one, but let me suggest an optimization (this is how I did it some weeks ago):

In showthread.php FIND
PHP Code:

post_parsed.pagetext_htmlpost_parsed.hasimages

BELOW that ADD
PHP Code:

NOT ISNULL(customprofilepic.userid) AS haspic

Further down in showthread.php FIND
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "post_parsed AS post_parsed ON(post_parsed.postid post.postid

BELOW that ADD
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "customprofilepic ON(customprofilepic.userid=post.userid

And use this template modification:

In template postbit FIND
PHP Code:

$post[onlinestatus

BELOW that ADD
PHP Code:

<if condition="$post['haspic']"><img src="/photo.gif" border=0 alt="Photo in Profile!"></if> 

That's it. This way you don't have to alter table user, file profile.php and functions_showthread.php.
You also might want to extend this for single post display and PM ;)

Do we need to do this in the posts AND the caheposts queries?

Andreas 07-04-2004 10:59 AM

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.

Boofo 07-04-2004 11:42 AM

Quote:

Originally Posted by KirbyDE
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.

I installed it in both queries. I'll test it out for hybrid and threaded and let you know. Thanks.

y2krazy 08-30-2004 12:57 AM

/me clicks install!

SIINSI 01-01-2005 07:29 PM

Quote:

Originally Posted by y2krazy
[high]* y2krazy clicks install![/high]

For some reason I get a parse error on this line...

{$mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$

Miguel

Chazz Layne 01-10-2005 02:55 AM

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:

Andreas 01-12-2005 12:38 AM

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?

DR?@M W?@V?R 01-14-2005 05:39 PM

Quote:

Originally Posted by SIINSI
For some reason I get a parse error on this line...

{$mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$

Miguel

same here as well, also the code changes for profile.php are different for 3.0.5.

DR?@M W?@V?R 01-14-2005 06:13 PM

Quote:

Originally Posted by KirbyDE
Nice one, but let me suggest an optimization (this is how I did it some weeks ago):

In showthread.php FIND
PHP Code:

post_parsed.pagetext_htmlpost_parsed.hasimages

BELOW that ADD
PHP Code:

NOT ISNULL(customprofilepic.userid) AS haspic

Further down in showthread.php FIND
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "post_parsed AS post_parsed ON(post_parsed.postid post.postid

BELOW that ADD
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "customprofilepic  AS customprofilepic ON(customprofilepic.userid=post.userid

And use this template modification:

In template postbit FIND
PHP Code:

$post[onlinestatus

BELOW that ADD
PHP Code:

<if condition="$post['haspic']"><img src="/photo.gif" border=0 alt="Photo in Profile!"></if> 

That's it. This way you don't have to alter table user, file profile.php and functions_showthread.php.
You also might want to extend this for single post display and PM ;)

Thanks for that it works on 3.0.5 in all display modes :)

I added this code to the image link.

<if condition="$post['haspic']"><a href="image.php?u=$post[userid]&amp;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.

DR?@M W?@V?R 01-15-2005 07:55 AM

Sorted.

PHP Code:


<if condition="$post['haspic']"><a href="image.php?u=$post[userid]&amp;type=profile" onclick="window.open('image.php?u=$post[userid]&amp;type=profile', 'popup', 'statusbar=no,menubar=no,scrollbars=no,resizable=no,width=110,height=110'); return false"><img src="$stylevar[imgdir_misc]/photo.gif" align="absmiddle" border=0 alt="$post[musername] Has A Photo Click Here To View"></a></if> 


MorrisMcD 01-17-2005 01:35 AM

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

DR?@M W?@V?R 01-17-2005 09:36 AM

Quote:

Originally Posted by MorrisMcD
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

If you read KirbyDE post for the the optimized version all you need to edit is showthread.php and thats it done.

MorrisMcD 01-17-2005 01:02 PM

Quote:

Originally Posted by DR?@M W?@V?R
If you read KirbyDE post for the the optimized version all you need to edit is showthread.php and thats it done.

I saw that but I noticed that

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

Andreas 01-17-2005 01:11 PM

As already stated here you must edit both queries.

MorrisMcD 01-17-2005 01:12 PM

Quote:

Originally Posted by KirbyDE
As already stated here you must edit both queries.

I thought that is what was meant, but I just wanted to check..

Thanks

MorrisMcD 01-17-2005 01:31 PM

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

Andreas 01-17-2005 01:44 PM

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 :)

Alien 03-20-2005 12:31 AM

Quote:

Originally Posted by KirbyDE
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 :)

Again, this is awesome.. Nice work..

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..

ninjaneo 04-02-2005 12:32 AM

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 ########

## FIND:
$show['messageicon'] = iif($post['iconpath'], true, false);


## BELOW ADD:

        // profile pic in thread
        if ($post[haspic] == "" && isset($post['userid']))
        {
            $show['haspic']=false;
            $mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$
                if ($mjctemp[count]==1) {
                        $show['haspic']=true;
                        $DB_site->query("UPDATE " . TABLE_PREFIX . "user SET haspic='1' WHERE userid = $post[userid]");
                } else {
                        $DB_site->query("UPDATE " . TABLE_PREFIX . "user SET haspic='0' WHERE userid = $post[userid]");
                }
        } else {
                if ($post[haspic]=="1")
                { $show['haspic']=true; }
                else
                { $show['haspic']=false; }
        }
        // profile pic in thread

// SAVE & CLOSE includes/functions_showthread.php

[high]* ninjaneo points to
[/high]
Code:

            $mjctemp = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "customprofilepic WHERE userid=" . $pos$

HarryBO 05-22-2005 06:23 PM

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$

Marco van Herwaarden 05-23-2005 09:54 AM

Replace the line:
PHP Code:

            $mjctemp $DB_site->query_first("SELECT count(*) AS count FROM " TABLE_PREFIX "customprofilepic WHERE userid=" $pos

with:
PHP Code:

            $mjctemp $DB_site->query_first("SELECT count(*) AS count FROM " TABLE_PREFIX "customprofilepic WHERE userid=" $post['userid']); 



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
  • Page Generation 0.02168 seconds
  • Memory Usage 1,864KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (21)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete