4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: trez on February 28, 2006, 10:42:52 AM

Title: [MOD] - Skype name & status shown in profile
Post by: trez on February 28, 2006, 10:42:52 AM
Hi,

this is my first MOD i do alone, so please excuse any errors or any complications with other MOD's.

What?

This little addon to 4images let your users put their skype-name into their profile, and shows automaticly the status (online,offline, etc) of the member in his profile.
Your users have to install skype 2.x in order to show the actual status. If a user is using a lower version will show status "unknown" (thx 2 v@no)

Files to edit
/includes/db_field_definitions.php
/lang/main.php
/member.php
/templates/yourtemplate/member_editprofile.html
/templates/yourtemplate/member_profile.html

Time / Difficulty

10 minutes / easy

Demo:

here: http://www.ggrec.com/zapomnime2/member.php?user_id=44&action=showprofile

Screenshot:

(http://www.ggrec.com/misc/skype.JPG)


********************

Step 1

add a new field into your 4images_users (using PhpMyAdmin)
user_skype      varchar(255)     cp1251_general_ci <-- (only for cyrillic suport)

Step 2

open /includes/db_field_definitions.php

find:

Code: [Select]
?>
add above:

Code: [Select]
$additional_user_fields['user_skype'] = array($lang['user_skype'], "text", 0);
save & close

Step 3

open /lang/english/main.php

find:

Code: [Select]
$lang['icq'] = "ICQ:";
add below

Code: [Select]
$lang['skype'] = "Skype";
$lang['skype_status'] = "Status";

save & close

Step 4

open member.php

find:

Code: [Select]
    $sql = "UPDATE ".USERS_TABLE."
            SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];

replace with:

Code: [Select]
    $sql = "UPDATE ".USERS_TABLE."
            SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql." ".get_user_table_field("", "user_skype")." = '$user_skype'".$additional_sql."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];


find:

Code: [Select]
$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";
add below

Code: [Select]
$user_skype = (isset($HTTP_POST_VARS['user_skype'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_skype'])) : ""; 

find:

Code: [Select]
"user_icq_button" => $user_icq_button,
add below

Code: [Select]
       
"user_skype" => $user_skype,

find:

Code: [Select]
"lang_icq" => $lang['icq'],
add below

Code: [Select]
"lang_skype" => $lang['skype'],
find:

Code: [Select]
    $user_icq = (isset($user_row['user_icq'])) ? $user_row['user_icq'] : REPLACE_EMPTY;
    if (!empty($user_icq) && $user_icq != REPLACE_EMPTY) {
      $user_icq_button = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$user_icq."\" target=\"_blank\"><img src=\"http://web.icq.com/whitepages/online?icq=".$user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$user_icq."\" /></a>";
    }
    else {
      $user_icq_button = REPLACE_EMPTY;
    }

add below
Code: [Select]
$user_skype = (isset($user_row['user_skype'])) ? $user_row['user_skype'] : REPLACE_EMPTY;


Step 5

open /templetaes/yourtemplate/member_editprofile.html

find

Code: [Select]
         <TR>
           <TD class="row2"><B>{lang_icq}</B></TD>
           <TD class="row2"><INPUT type="text" name="user_icq"  size="30" value="{user_icq}" class="input" /></TD>
         </TR>

add below

Code: [Select]
         <TR>
           <TD class="row2"><B>{lang_skype}</B></TD>
           <TD class="row2"><INPUT type="text" name="user_skype"  size="30" value="{user_skype}" class="input" /></TD>
         </TR>

Step 6

open /templates/yourtemplate/member_profile.html

find:

Code: [Select]
        <tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>

add below

Code: [Select]
         {if user_skype}<TR>
           <TD class="row2"><B>SKYPE</B></TD>
           <TD class="row2"><a href="callto://{user_skype}">call me!</a> my current status: <img src="http://mystatus.skype.com/smallclassic/{user_skype}.png"></TD>
         </TR>{endif user_skype}

******************************

Of course you have to edit your templates to your design. You can also use additional language tags for "call me" etc., just register them in your main language file and use them in your templates.

You can also link the status button to the "call me" function when you past in step 6 this code:

Code: [Select]
         <TR>
           <TD class="row2">{lang_skype}</TD>
           <TD class="row2"><a href="callto://{user_skype}"> <img src="http://mystatus.skype.com/smallclassic/{user_skype}.png" border=0></a> </TD>
         </TR>

In order to use the status, the user has to enabled "show status on web" , FAQ here: http://www.skype.com/share/buttons/status.html and Skype 2.x has to been installed!

For custom status icons check V@no's answer right below (5)

MOD has ben coded and tested oin a fresh 4images 1.7.1 installation. More expirienced members, please post any bugfixes for that MOD, its my first one so i maybe made a mistake - at least it works ;)
Title: Re: [MOD] - Skype name & status shown in profile
Post by: V@no on February 28, 2006, 02:36:20 PM
Some notes:
1) nice mod!
2) you forgot to mention, that in order the online status properly work, Skipe v2.x must be installed, otherwise it will show status as "unknown"
3) since skype usernames can contein letters, you should not use intval() function in Step 4.
4) in Step 2 you made the skype username input to be required, yet, far not everyone is using it and will be pissed off cause they wont be able update their profile untill they enter anything in the skype field :?
5) If you want to use custom status icons, here (http://www.onlinestatus.org/forum/viewtopic.php?t=27) you can find a php function that returns a status "code". ;)

I'll wait for some responces on how this mod works untill I move it to MODs forum ;)
Title: Re: [MOD] - Skype name & status shown in profile
Post by: trez on February 28, 2006, 03:18:21 PM
Thanks for the answer V@no,

Step 2 and 4 are updated with the right code.

;)
Title: Re: [MOD] - Skype name & status shown in profile
Post by: JensF on March 01, 2006, 05:20:46 PM
What is this???

Quote
cp1251_general_ci <-- (only for cyrillic suport)

is this important???
Title: Re: [MOD] - Skype name & status shown in profile
Post by: IcEcReaM on March 01, 2006, 06:47:07 PM
no not for you,
it's just for trez to save the bulgarian letters probably.
Title: Re: [MOD] - Skype name & status shown in profile
Post by: V@no on March 02, 2006, 01:51:13 AM
and only applyed for MySQL v4.x or newer
Title: Re: [MOD] - Skype name & status shown in profile
Post by: trez on March 02, 2006, 02:44:32 PM
sorry that i wasn't here to answer the questions, but i had a lot of personal work to do. It won't happen again.

Also, if someone of the 76 viewers has installed the MOD, please post a short comment if its working for you r not, so the topic can be moved to the MODs forum.

Thanks in advise,

Georgi
Title: Re: [MOD] - Skype name & status shown in profile
Post by: Loda on March 02, 2006, 03:51:32 PM
hallo!
on my site it show an red x in my profil. in the profils of the other members ist shows the button "i'm not telling"
after i install this: http://plugin.jyve.com/?fuse=download
on my computer and change the code in member_profile.html to this:
Code: [Select]
{if user_skype}{user_skype}&nbsp;&nbsp;<a href="callto://{user_skype}"><img src="http://www.skypepresence.com/callbutton/{user_skype}.gif" border="0"></a>{endif user_skype}then it works.
Title: Re: [MOD] - Skype name & status shown in profile
Post by: trez on March 02, 2006, 05:29:21 PM
hallo!
on my site it show an red x in my profil. in the profils of the other members ist shows the button "i'm not telling"
after i install this: http://plugin.jyve.com/?fuse=download
on my computer and change the code in member_profile.html to this:
Code: [Select]
{if user_skype}{user_skype}&nbsp;&nbsp;<a href="callto://{user_skype}"><img src="http://www.skypepresence.com/callbutton/{user_skype}.gif" border="0"></a>{endif user_skype}then it works.


the red X sounds like a broken link to the skype status-image, somewhere made a mistake maybe?

About the Jive plugin, if you want to show additional fields in your members profile (send message to member, open chat, etc.) this plugin might be usefull otherwise its NOT needet.
Title: Re: [MOD] - Skype name & status shown in profile
Post by: Loda on March 02, 2006, 06:35:28 PM
ahhh..
i think, i know what the mistake is..
my skype-name ist blabla.bla
maybe it doesn't like a point...
Title: Re: [MOD] - Skype name & status shown in profile
Post by: V@no on March 03, 2006, 01:13:01 AM
ahhh..
i think, i know what the mistake is..
my skype-name ist blabla.bla
maybe it doesn't like a point...

I just created an account with a dot in the name and it showed status just fine. Perhaps at the time you tested it Skype's web status site was down, which is happend pretty often...
Title: Re: [MOD] - Skype name & status shown in profile
Post by: martrix on June 09, 2006, 06:02:57 PM
Very nice thing!

As the ICQ status is also shown under every member's comment,
it would be nice to have the skype status shown there too ;)
Title: Re: [MOD] - Skype name & status shown in profile
Post by: Blackman on June 10, 2006, 04:52:49 PM
Hi, this is great mod, but i can't use phpmyadmin this server.. can you make for me install.php program, what drop "user_skype      varchar(255)" in my sql database...?
thanx
Title: Re: [MOD] - Skype name & status shown in profile
Post by: V@no on June 10, 2006, 05:51:13 PM
you can always install phpmyadmin yourself...
Title: Re: [MOD] - Skype name & status shown in profile
Post by: Blackman on June 10, 2006, 07:33:36 PM
oh.. yes! sorry;)
Title: Re: [MOD] - Skype name & status shown in profile
Post by: Icemann71 on June 25, 2006, 02:19:22 AM
Kann man diesen mod auch in der memberlist einbauen?

Can build the mod into memberlist?
Title: Re: [MOD] - Skype name & status shown in profile
Post by: qpatrick on November 01, 2006, 11:46:22 AM
works in 1.7.4
Title: Re: [MOD] - Skype name & status shown in profile
Post by: @rtur on November 12, 2006, 04:26:45 PM
For custom status icons check V@no's answer right below (5)

Where paste code from site www.onlinestatus.org (http://www.onlinestatus.org/forum/viewtopic.php?t=27) ?

Code: [Select]
function get_skype_status($id)
{
  if (empty($id)) return 0;
  if (!$fp = @fsockopen('mystatus.skype.com', 80, $errno, $errstr, 8)) return 0;
  $request = "GET /balloon/".$id." HTTP/1.0\r\n"
            ."Host: mystatus.skype.com\r\n"
            ."Connection: close\r\n\r\n";
  fputs($fp, $request);
  do
  {
    $result = fgets($fp, 1024);
  }
  while (!feof($fp) && !stristr($result, 'Location'));
  $result = preg_replace("/[^0-9]/", "", $result);
  return ($result && (int)$result < 8) ? $result : 0;
}

paste only this code?

Please add code For Custom status icons from www.onlinestatus.org (http://www.onlinestatus.org/forum/viewtopic.php?t=27) in this MOD

Thanks