Last updated October 18, 2011. Created by Dublin Drupaller on October 30, 2005.
Edited by MGParisi, bekasu, add1sun. Log in to edit this page.
PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.
Note: There is also a Skype Support module.
Description
This php snippet adds a Skype: Call me! button to their user profile page if they are online or a Leave a voicemail! message if the user is offline.
If the user has not specified their skype username, it displays nothing.
Dependencies: profile.module must be installed and enabled.
An optional extra little piece of javascript checks to see if the user viewing the profile page has skype installed and displays a friendly link explaining what it is if they don't. Click through to skype.com for what the alternate message on the skype.com site looks like and says.
Usage
- For use in your user profile page override (user_profile.tpl.php)
- Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
- You need to change the custom profile field name from
profile_skypenameused in the first 2 lines of the snippet if you call the profile field something else. (Tip: go to administer -->> settings -->> profile and in the second column it will give you the field name) - Tested and works with Drupal 4.5 and 4.6
- Change the div class name or the link text to suit.
- Click through to the custom skype buttons page at skype.com to choose alternate button images, or alternatively create your own and edit the IMG links in the snippet. (before editing, make a note of the syntax and in particular how you have to comment out quotation marks using the back slash symbol.)
- Click for a more advanced snippet (.rar) or zip version that includes a small javascript check to see if the user has skype installed or not and displays an appropriate message if they don't. (I can't upload the advanced snippet here because of the javascript).
Notes
This is not intended as an official endorsement of the Skype webphone. There are many other webphones out there and I plan to update the snippets in future as the VOIP (Voice over IP) technology evolves and improves. Giving users more options and alternate webphone snippets.
<?php
if($user->profile_skypename) {
$time_period = variable_get('user_block_seconds_online', 2700);
$uid = arg(1); // get the current userid that is being viewed.
$users = db_query('SELECT DISTINCT(uid), MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid = %d GROUP BY uid ORDER BY max_timestamp DESC', time() - $time_period, $uid);
$total_users = db_num_rows($users);
if ($total_users == 1) {
print "<a href=\"skype:$skypename?call\"><img src=\"http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png\" style=\"border: none;\" width=\"124\" height=\"52\" alt=\"Call me!\" /></a>";
}
else {
print "<a href=\"skype:$skypename?voicemail\"><img src=\"http://download.skype.com/share/skypebuttons/buttons/voicemail_blue_white_213x52.png\" style=\"border: none;\" width=\"213\" height=\"52\" alt=\"Leave me voicemail\" /></a>";
}
}
?>Drual 4.7
<?php if($user->profile_skypename):?>
<script type="text/javascript" src"http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
<a href="skype:<?php print $user->profile_skypename ?>?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png" alt="My status" title="Call <?php print $user->name ?> using Skype"/></a>
<?php endif ?>
Comments
Skype status button with Computed filed module, in Drupal 6.x
I made this with Computed field module, in Drupal 6.x: http://drupal.org/node/957646
-----------
Önismeret, személyiségfejlesztés, meditáció, spiritualitás.