Poll

Where is my problem?

mySQL
1 (100%)
PHP
0 (0%)
mySQL
0 (0%)
PHP
0 (0%)

Total Members Voted: 1

Author Topic: Skype status shown in comment  (Read 10099 times)

0 Members and 1 Guest are viewing this topic.

Offline clubsociety

  • Newbie
  • *
  • Posts: 22
    • View Profile
Skype status shown in comment
« 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:

Code: [Select]
 $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:
Code: [Select]
       $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:
Code: [Select]
   {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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Skype status shown in comment
« Reply #1 on: June 07, 2009, 06:01:43 AM »
You did everything right except for one little detail. You cannot use $user_table_fields array for custom fields.
This is correct way:
Code: [Select]
$comment_row[$i]['user_skype']
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline clubsociety

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Skype status shown in comment
« Reply #2 on: June 07, 2009, 07:51:26 AM »
Hi,

I changed what you mentioned:
Code: [Select]
// ***** 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Skype status shown in comment
« Reply #3 on: June 07, 2009, 02:39:16 PM »
try replace the mysql query with this:
Code: [Select]
 $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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline clubsociety

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Skype status shown in comment
« Reply #4 on: June 07, 2009, 09:31:01 PM »
Thanx, now it's workung fine.

I think I've to learn more about mySQL in the future.

Clubsociety

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: Skype status shown in comment
« Reply #5 on: August 01, 2010, 10:56:11 AM »
This part of SQL query must be correct. If you added new additional table.

Code: [Select]
  $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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Skype status shown in comment
« Reply #6 on: August 01, 2010, 02:56:26 PM »
get_user_table_field() function also cannot be used for additional fields.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: Skype status shown in comment
« Reply #7 on: August 02, 2010, 03:35:20 PM »
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