4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: clubsociety on June 07, 2009, 04:24:42 AM
-
Hi there,
I've a problem (...of course, otherwise I would not use the board). I wanted to show the Skype status of the comment's authors.
I already read many things about this mod in the board and I added it to my page, BUT I think the value, whitch I get from my database is empty I and don't understand why. I already checked the table and the cell is not empty.
I added .get_user_table_field(", u.", "user_skype") as follows in details.php:
$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").get_user_table_field(", u.", "user_skype")."
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);
And I added lines 6 to 11 to show the status, if a Skype name is set:
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
if (!empty($comment_user_icq)) {
$comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
}
// ***** Skype Status 04.06.09 *****************************************
$comment_user_skype = (isset($comment_row[$i][$user_table_fields['user_skype']])) ? format_text($comment_row[$i][$user_table_fields['user_skype']]) : "";
if (!empty($comment_user_skype)) {
$comment_user_skype_button = "<a href=\"callto://".$comment_user_skype."\">Test1</a>Test2<img src=\"http://mystatus.skype.com/smallicon/".$comment_user_skype."\" /></a>";
}
// ***** Skype Status 04.06.09 *****************************************
But it look like that $comment_user_skype is empty, because nothig is shown as long I remove the ! in front of empty in line 8.
Of course I added the variable to comment_bit.html:
{comment_user_icq_button}
<!-- ***** Skype Status 04.06.09 ***********************************-->
{comment_user_skype_button}
<!-- ***** Skype Status 04.06.09 ***********************************-->
I'm not familiar with mySQL and I don't know what kind of mistake I made. So please feel free to help me.
Regards
clubsociety
-
You did everything right except for one little detail. You cannot use $user_table_fields array for custom fields.
This is correct way:
$comment_row[$i]['user_skype']
-
Hi,
I changed what you mentioned:
// ***** Skype Status 04.06.09 *****************************************
$comment_user_skype = (isset($comment_row[$i]['user_skype'])) ? format_text($comment_row[$i]['user_skype']) : "";
if (!empty($comment_user_skype)) {
$comment_user_skype_button = "<a href=\"callto://".$comment_user_skype."\">Test1</a>Test2<img src=\"http://mystatus.skype.com/smallicon/".$comment_user_skype."\" /></a>";
}
// ***** Skype Status 04.06.09 *****************************************
... but it still does not work.
Any idea???
Regards clubsociety
-
try replace the mysql query with this:
$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").", u.user_skype
I missed that the first time, get_user_table_field() function also cannot be used for additional fields.
-
Thanx, now it's workung fine.
I think I've to learn more about mySQL in the future.
Clubsociety
-
This part of SQL query must be correct. If you added new additional table.
$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").$additional_sql.get_user_table_field(", u.", "user_skype")."
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
-
get_user_table_field() function also cannot be used for additional fields.
-
Thanks for inform about that, Vano. Also this mod need some corrections. If it need i can do this and publish it in fully work version