General / Allgemeines > Programming
Extern Avatar from WBB in 4images Comment
Sunny C.:
Hello,
this is the wcf1_avatar table from Woltlab Burning Board
i will show the Avatar of the user in 4images comment
I use wordpress + 4images + woltlab nurning board. The userīs have all the same ID, i have a single registration for wordpress/4images and wbb
i will use {comment_user_avatar} in the comment for showing the WBB Avatar
Sorry for my english....
V@no:
Maybe something like this?
In details.php find:
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE c.image_id = $image_id
ORDER BY c.comment_date ASC";
$result = $site_db->query($sql);
Replace with:
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").", a.avatarID
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
LEFT JOIN wcf1_avatar a ON (a.userID = ".get_user_table_field("u.", "user_id").")
WHERE c.image_id = $image_id
ORDER BY c.comment_date ASC";
$result = $site_db->query($sql);
Then find:
"comment_user_ip" => $comment_user_ip,
Insert below:
"comment_user_avatar" => $comment_row[$i]['avatarID'],
Sunny C.:
Hi Vano,
thank you very very much, but the avatarName dont work. this is the name of the uploaded Avatar. WBB changed name to avatar-avatarID.avatarExtension
http://siteurl/wp-forum/wcf/images/avatars/avatar-2.jpg
Can you help me?
V@no:
The avatarName in your screenshot contains filename for the avatar image (1-4a9b3ea1150f7e9c.jpg), and you are saying that actual filename is different?
what is the actual filename of the avatar for the user with id 1?
perhaps all you need to do is change the directory in your <img> tag?
--- Code: ---<img src="path_to_avatars_directory/{comment_user_avatar}">
--- End code ---
Sunny C.:
Yes, the filename is
avatar-2.jpg
Split
avatar - avatarID . avatarExtension
The name "1-4a9b3ea1150f7e9c.jpg" is the uploaded filename
example "myavatar.png"
i uploaded "myavatar.png"
wbb change the name "myavatar.png" to "avatar-3.png"
please look at my atachment
dont work
--- Code: ---<img alt="" src="../wp-forum/wcf/images/avatars/1-4a9b3ea1150f7e9c.jpg" class="avatar avatar-32" height="32" width="32">
--- End code ---
work
--- Code: ---<img alt="" src="../wp-forum/wcf/images/avatars/avatar-2.jpg" class="avatar avatar-32" height="32" width="32">
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version