PDA

View Full Version : Help with how to Show profile pic 'indication' if true, in post-bit..


Razasharp
09-11-2005, 06:39 PM
Ok total nube here!

I've started to learn PHP and thought I would try to make a small hack to the post-bit in vB.

I want it to show a visual idication if someone has uploaded a profile pic and was trying to do it with this code:

<if condition="$userinfo['profilepic']">
<img src="images/hasprofile.gif" alt="Has a profile pic" />
</if>

I've also tried:

<if condition="$show['profilepic']">

and:

<if condition="$userinfo['profilepic'] = true">

But not sure what I'm doing really!

Do I need to make sure that value has loaded by making sure it is called in the actual php file too?

Any ideas?

sorry to be a total nube :(

Gio~Logist
09-11-2005, 10:22 PM
I'm Trying To Do The Same Thing In Online.php!!!!!!!!!!!!!!!


For postbit try


<if condition="$post['profilepic']">
<img src="images/hasprofile.gif" alt="Has a profile pic" />
</if>

Razasharp
09-11-2005, 10:28 PM
that doesnt work either :(

I'm thinking perhaps it needs to be called in the associated php file as well for it to be resident in memory? maybe the result queried from the DB?...

Andreas
09-11-2005, 10:28 PM
1) The Information "User has a Profile Picture" doesn't exist.
You havre to aggregate it somehow, for example by making a join on the custompprofilepic table

2) $post for sure will not work in WOL

3) Take a look at my Profile

Razasharp
09-11-2005, 10:37 PM
Thanks Andreas... it's too much then :( I think I will wait utill I upgrade to 3.5 and then use your hack :)

Thanks for taking the time to put us out of our misery! :p

Andreas
09-11-2005, 10:39 PM
Use Search, there is a 3.0 Hack that does it.

Razasharp
09-11-2005, 10:53 PM
OK I found this....

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

In showthread.php FIND

post_parsed.pagetext_html, post_parsed.hasimages,


BELOW that ADD

NOT ISNULL(customprofilepic.userid) AS haspic,


Further down in showthread.php FIND

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


BELOW that ADD

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


And use this template modification:

In template postbit FIND

$post[onlinestatus]


BELOW that ADD

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

*goes to try* :)

bigcurt
09-11-2005, 11:31 PM
There IS 3.0.X hack that does this..I know there is, I even remember the little pic of the camera, BUT, I cannot find it ANYWHERE.

~Curt

Razasharp
09-11-2005, 11:52 PM
For Post bit.... the quote in my post above works :)

(Thanks Kirby!)

Andreas
09-11-2005, 11:57 PM
I knew it works, as I am running this Code in my production Board ;)

Gio~Logist
09-12-2005, 12:43 AM
I used this in online.php (after putting it in the right spots in online.php) and it works fine as long as there are no guests online. The second a guest comes online i get this.


Database error in vBulletin 3.0.7:

Invalid SQL:
SELECT user.username, session.useragent, session.location, session.lastactivity, user.userid, user.options, session.host, session.badlocation, session.incalendar, user.aim, user.icq, user.msn, user.yahoo,
NOT ISNULL(customprofilepic.userid) AS haspic,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM session AS session
LEFT JOIN customprofilepic AS customprofilepic ON(customprofilepic.userid=user.userid)
LEFT JOIN user AS user USING (userid)
WHERE session.lastactivity > 1126487892

ORDER BY user.username asc

mysql error: Cross dependency found in OUTER JOIN. Examine your ON conditions

mysql error number: 1120

Date: Sunday 11th of September 2005 09:33:12 PM
Script: http://www.net-fam.com/online.php?
Referer: http://www.net-fam.com/forums.php
Username: gio~logist
IP Address: xx.xxx.xxx.xx