PDA

View Full Version : Profile Picture in Postbit


DGTLMIK
06-18-2005, 09:25 PM
In an attempt to get the Profile Picture to be displayed in a User's Post, I copied:
<if condition="$show['profilepic']">
<td valign="top" align="$stylevar[right]" rowspan="2">
<img src="image.php?u=$userinfo[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_picture]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]" />
</td>
</if>from the 'MEMBERINFO' Template into the 'postbit_legacy' Template but the Profile Picture was not displayed.

Then, I removed the 'IF' Statement, '<TD>' Tags, and 'alt=' info ending up with:
<img src="image.php?u=$userinfo[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]" alt="" border="0" style="border:1px solid $stylevar[tborder_bgcolor]" />
Doing so does display the Profile Picture in a User's Post; however, if the Profile Picture is either deleted or changed to another one, the same Profile Picture is still displayed in that User's Post. An investigation revealed that the 'dateline' is not being included in the 'img src' URL. So, if I go to that User?s Profile, Right-Click on their, now changed, Profile Picture, which is displayed correctly, select Properties and replace '$userinfo[profilepicdateline]' with that 'dateline number', then the new image is displayed properly in the User?s Post.

What am I missing?

DGTLMIK
06-20-2005, 04:11 PM
Bump...

Andreas
06-20-2005, 05:24 PM
I wonder why it does display anything ... it should be $post[userid].
However, if you want the dateline in there you must modify the $posts/$cacheposts queries in showthread.php to make a left join on table customprofilepic and get the dateline from this table.
Furthermore, you should add an if to avoid image.php also being called for users that do not even have profile pictures.

DGTLMIK
06-20-2005, 08:00 PM
I wonder why it does display anything ... it should be $post[userid].
I changed it as you indicated and cleaned it up some more ending up with:

<img src="image.php?u=$post[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]" alt="" border="0" />

However, if you want the dateline in there you must modify the $posts/$cacheposts queries in showthread.php to make a left join on table customprofilepic and get the dateline from this table.
Furthermore, you should add an if to avoid image.php also being called for users that do not even have profile pictures.
Could you help me out with this part? I am not familiar enough with PHP to know how to perform these two steps. Thanks in advance.

Andreas
06-20-2005, 10:00 PM
There is a Thread about displaying an icon in postbit if a user has a profile picture somewhere - take a look at it.

DGTLMIK
06-21-2005, 02:11 PM
There is a Thread about displaying an icon in postbit if a user has a profile picture somewhere - take a look at it.
I added the 2 lines from that Thread to both '$posts' and '$cacheposts' in 'showthread.php' and the Profile Pic is displayed in all Display Modes and goes away when I delete the Profile Picture from the User Control Panel as it should. Now, the only thing left is, what code do I need to add to 'showthread.php' to grab the 'customprofilepic.dateline' ?

Andreas
06-21-2005, 02:13 PM
customprofilepic.dateline AS picdateline or smth. like this :)

DGTLMIK
06-21-2005, 02:19 PM
Sorry, I'm still a Noobie :o , where in here do I put that?

$posts = $DB_site->query("
SELECT
post.*, post.username AS postusername, post.ipaddress AS ip,
user.*, userfield.*, usertextfield.*,
" . iif($forum['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "
" . iif($vboptions['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.avatardata) AS hascustomavatar, customavatar.dateline AS avatardateline,') . "
" . iif($vboptions['reputationenable'], 'level,') . "
" . iif(!$deljoin, 'NOT ISNULL(deletionlog.primaryid) AS isdeleted, deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,') . "
editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,
editlog.reason AS edit_reason,
post_parsed.pagetext_html, post_parsed.hasimages,
NOT ISNULL(customprofilepic.userid) AS haspic,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
" . iif(!($permissions['genericpermissions'] & CANSEEHIDDENCUSTOMFIELDS), $datastore['hidprofilecache']) . "
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
" . iif($forum['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "
" . iif($vboptions['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") .
iif($vboptions['reputationenable'], " LEFT JOIN " . TABLE_PREFIX . "reputationlevel AS reputationlevel ON(user.reputationlevelid = reputationlevel.reputationlevelid)") . "
" . iif(!$deljoin, "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND deletionlog.type = 'post')") . "
LEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)
LEFT JOIN " . TABLE_PREFIX . "post_parsed AS post_parsed ON(post_parsed.postid = post.postid)
LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON(customprofilepic.userid = post.userid)
WHERE $postids
ORDER BY dateline $postorder
");

Andreas
06-21-2005, 02:25 PM
In the $posts and $cacheposts queries somewhere between SELECT and FROM, for example after NOT ISNULL(customprofilepic.userid) AS haspic :)
To learn more about queries I suggest to read the mySQL manual @ http://www.mysql.com

DGTLMIK
06-21-2005, 02:49 PM
In the $posts and $cacheposts queries somewhere between SELECT and FROM, for example after NOT ISNULL(customprofilepic.userid) AS haspic :)
Thanks for the hint:

NOT ISNULL(customprofilepic.userid) AS haspic, customprofilepic.dateline AS profilepicdateline,
:)

BabyU
07-19-2005, 06:58 PM
Would you mind posting out what you ended up doing step by step? I tried following the various posts above, but I'm easily confused. :D I'd appreciate a little guidance to complete the same modification. Thanks!

007
10-12-2005, 09:51 PM
I would appreciate this too. What did you do to get it to work?

PennylessZ28
12-27-2005, 05:08 AM
Like wise

OneShot
02-18-2006, 07:32 PM
Anybody tried to make this as a Plugin for 3.5.x ?

riverpoet
08-08-2006, 11:43 PM
Wow, can't believe how easy this is (vB 3.5.4)!

Add a PLUG-IN with HOOK LOCATION showthread_query and the following code:

$hook_query_fields = ",customprofilepic.dateline AS profilepicdateline";
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON(customprofilepic.userid = post.userid)";

In POSTBIT template, add :

<if condition="$post['profilepicdateline']">
<img src="image.php?u=$post[userid]&dateline=$post[profilepicdateline]&type=profile">
</if>

NOTE: This will only work if you're using the database for avatar/profilepic storage!

Ascor
12-29-2006, 11:13 AM
Thank you riverpoet, this work nice in 3.6.4 :)

Saskia
12-30-2006, 05:56 PM
Thanks riverpoet! Works like a charm in 3.6.4.

Saskia
06-27-2007, 11:33 AM
Question, they don't show up when quick replying, at least not until you hit refresh. Any ideas on how to do this?

dcw
05-07-2008, 02:57 AM
anyone try this with 3.7 yet?