4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started 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:
?>
add above:
$additional_user_fields['user_skype'] = array($lang['user_skype'], "text", 0);
save & close
Step 3
open /lang/english/main.php
find:
$lang['icq'] = "ICQ:";
add below
$lang['skype'] = "Skype";
$lang['skype_status'] = "Status";
save & close
Step 4
open member.php
find:
$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:
$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:
$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";
add below
$user_skype = (isset($HTTP_POST_VARS['user_skype'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_skype'])) : "";
find:
"user_icq_button" => $user_icq_button,
add below
"user_skype" => $user_skype,
find:
"lang_icq" => $lang['icq'],
add below
"lang_skype" => $lang['skype'],
find:
$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
$user_skype = (isset($user_row['user_skype'])) ? $user_row['user_skype'] : REPLACE_EMPTY;
Step 5
open /templetaes/yourtemplate/member_editprofile.html
find
<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
<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:
<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
{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:
<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 ;)
-
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 ;)
-
Thanks for the answer V@no,
Step 2 and 4 are updated with the right code.
;)
-
What is this???
cp1251_general_ci <-- (only for cyrillic suport)
is this important???
-
no not for you,
it's just for trez to save the bulgarian letters probably.
-
and only applyed for MySQL v4.x or newer
-
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
-
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:
{if user_skype}{user_skype} <a href="callto://{user_skype}"><img src="http://www.skypepresence.com/callbutton/{user_skype}.gif" border="0"></a>{endif user_skype}
then it works.
-
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:
{if user_skype}{user_skype} <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.
-
ahhh..
i think, i know what the mistake is..
my skype-name ist blabla.bla
maybe it doesn't like a point...
-
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...
-
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 ;)
-
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
-
you can always install phpmyadmin yourself...
-
oh.. yes! sorry;)
-
Kann man diesen mod auch in der memberlist einbauen?
Can build the mod into memberlist?
-
works in 1.7.4
-
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) ?
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