Author Topic: [MOD] - Skype name & status shown in profile  (Read 34258 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
[MOD] - Skype name & status shown in profile
« 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:




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

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 ;)
« Last Edit: February 28, 2006, 03:40:52 PM by trez »

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: [MOD] - Skype name & status shown in profile
« Reply #1 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 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 ;)
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 trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] - Skype name & status shown in profile
« Reply #2 on: February 28, 2006, 03:18:21 PM »
Thanks for the answer V@no,

Step 2 and 4 are updated with the right code.

;)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] - Skype name & status shown in profile
« Reply #3 on: March 01, 2006, 05:20:46 PM »
What is this???

Quote
cp1251_general_ci <-- (only for cyrillic suport)

is this important???
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: [MOD] - Skype name & status shown in profile
« Reply #4 on: March 01, 2006, 06:47:07 PM »
no not for you,
it's just for trez to save the bulgarian letters probably.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

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: [MOD] - Skype name & status shown in profile
« Reply #5 on: March 02, 2006, 01:51:13 AM »
and only applyed for MySQL v4.x or newer
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 trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] - Skype name & status shown in profile
« Reply #6 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

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] - Skype name & status shown in profile
« Reply #7 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.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] - Skype name & status shown in profile
« Reply #8 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.

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] - Skype name & status shown in profile
« Reply #9 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...

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: [MOD] - Skype name & status shown in profile
« Reply #10 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...
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 martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] - Skype name & status shown in profile
« Reply #11 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 ;)
MAяTRIX


Offline Blackman

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] - Skype name & status shown in profile
« Reply #12 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

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: [MOD] - Skype name & status shown in profile
« Reply #13 on: June 10, 2006, 05:51:13 PM »
you can always install phpmyadmin yourself...
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 Blackman

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] - Skype name & status shown in profile
« Reply #14 on: June 10, 2006, 07:33:36 PM »
oh.. yes! sorry;)