vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Profile Picture in Postbit (https://vborg.vbsupport.ru/showthread.php?t=83356)

DGTLMIK 06-18-2005 09:25 PM

Profile Picture in Postbit
 
In an attempt to get the Profile Picture to be displayed in a User's Post, I copied:
Code:

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

<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

Quote:

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

Code:

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

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

Quote:

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

PHP Code:

    $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

Quote:

Originally Posted by KirbyDE
In the $posts and $cacheposts queries somewhere between SELECT and FROM, for example after NOT ISNULL(customprofilepic.userid) AS haspic :)

Thanks for the hint:

PHP Code:

NOT ISNULL(customprofilepic.userid) AS haspiccustomprofilepic.dateline AS profilepicdateline

:)


All times are GMT. The time now is 11:21 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.01254 seconds
  • Memory Usage 1,765KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete