4images Forum & Community

General / Allgemeines => Programming => Topic started by: Sunny C. on July 10, 2010, 10:40:49 PM

Title: Extern Avatar from WBB in 4images Comment
Post by: Sunny C. on July 10, 2010, 10:40:49 PM
Hello,

this is the wcf1_avatar table from Woltlab Burning Board
i will show the Avatar of the user in 4images comment

(http://www.4homepages.de/forum/index.php?action=dlattach;topic=27520.0;attach=5564;image)

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
(http://www.4homepages.de/forum/index.php?action=dlattach;topic=27520.0;attach=5562;image)

i will use {comment_user_avatar} in the comment for showing the WBB Avatar

Sorry for my english....
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: V@no on July 10, 2010, 11:06:45 PM
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'],
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: Sunny C. on July 10, 2010, 11:55:24 PM
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?
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: V@no on July 11, 2010, 12:04:52 AM
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: [Select]
<img src="path_to_avatars_directory/{comment_user_avatar}">
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: Sunny C. on July 11, 2010, 12:08:22 AM
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: [Select]
<img alt="" src="../wp-forum/wcf/images/avatars/1-4a9b3ea1150f7e9c.jpg" class="avatar avatar-32" height="32" width="32">
work
Code: [Select]
<img alt="" src="../wp-forum/wcf/images/avatars/avatar-2.jpg" class="avatar avatar-32" height="32" width="32">
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: V@no on July 11, 2010, 12:26:20 AM
So, avatarID is being used?
in that case just replace all avatarName in my code with avatarID
(I've updated the code above)

and in template use:
Code: [Select]
<img alt="" src="../wp-forum/wcf/images/avatars/avatar-{comment_user_avatar}.jpg" class="avatar avatar-32" height="32" width="32">
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: Sunny C. on July 11, 2010, 12:32:25 AM
But what is with th avatarExtension

The Code
Code: [Select]
<img alt="" src="../wp-forum/wcf/images/avatars/avatar-{comment_user_avatar}.jpg" class="avatar avatar-32" height="32" width="32">
dont work with a png

<img alt="" src="../wp-forum/wcf/images/avatars/avatar-{comment_user_avatar}.jpg" class="avatar avatar-32" height="32" width="32">
the avatarExtension is individual
(http://www.4homepages.de/forum/index.php?action=dlattach;topic=27520.0;attach=5568;image)

This is now my code

  $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, a.avatarExtension
          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);

"comment_user_avatar" => $comment_row[$i]['avatarID'],
"comment_user_avatar_extension" => $comment_row[$i]['avatarExtension'],

The code work, but is this correckt?
Title: Re: Extern Avatar from WBB in 4images Comment
Post by: V@nо on July 11, 2010, 01:16:23 AM
sure, you got the idea ;)

you could simplify it to one template tag though:
Code: [Select]
"comment_user_avatar" => $comment_row[$i]['avatarID'] . "." . $comment_row[$i]['avatarExtension'],
Title: Avatare aus WBB für Kommentare / Avatars for comments from WBB
Post by: Sunny C. on December 09, 2011, 08:35:13 PM
:flag-de: Mit dieser Modifikation werden die Avatare aus dem "Woltlab Burning Board" in den Kommentaren von 4images benutzt
:flag-en: With this modification, the avatars of the "WoltLab Burning Board" used in the comments by 4images


Step #1

Öffne / Open: details.php
Suche / Search:
  $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);

Ersetze mit / 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, a.avatarExtension
          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);

Suche / Search:
 "comment_user_ip" => $comment_user_ip,
Füge danach ein / Add after
 "comment_user_avatar" => $comment_row[$i]['avatarID'] . "." . $comment_row[$i]['avatarExtension'],