Tutorial: How to COMPLETELY integrate Skype and Ventrillo into SMF.

Started by TechnoDragon, February 11, 2006, 07:04:55 PM

Previous topic - Next topic

TechnoDragon

How to COMPLETELY integrate Skype and Ventrillo into SMF.

After may hours of work (and that's saying something as I have near zero knowledge of PHP) I have figured out how to not only show the Skype and Ventrilo icons in a user profile and posts, but I also have suceeded in showing them in the Memberlist.

This has only been tested and verified on RC2 and the Skype version was 2.0.79 or higher.

(these should be in your themes directory either the specific theme or the default theme)
In display.template.php:

Find:

', $message['member']['yim']['link'], '<br />';

and replace:

', $message['member']['yim']['link'], '<br />
', $message['member']['Skype']['link'], '
', $message['member']['Ventrilo']['link'], '<br />';

In index.template.php:

Find:

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.

Replace:

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js">
</script>

In memberlist.template.php:

Find:

<td class="windowbg2">', $member['msn']['link'], '</td>

Replace:

<td class="windowbg2">', $member['msn']['link'], '</td>
<td class="windowbg2">', $member['Skype']['link'], '</td>
<td class="windowbg2">', $member['Ventrilo']['link'], '</td>

In profile.template.php:

Find:

<td>', $context['member']['yim']['link_text'], '</td>
</tr><tr>

Add after:

<td><b>Skype: </b></td>
<td>', $context['member']['Skype']['link_text'], '</td>
</tr><tr>
<td><b>Ventrilo: </b></td>
<td>', $context['member']['Ventrilo']['link_text'], '</td>
</tr><tr>

Find:

<td align="center">', $txt['MSN'], '</td>

Add after:

<td align="center">Skype</td>
<td align="center">Ventrilo</td>

Find:

<td align="center">', $buddy['msn']['link'], '</td>

Add after:

<td align="center">', $buddy['Skype']['link'], '</td>
<td align="center">', $buddy['Ventrilo']['link'], '</td>

Find:

<td><input type="text" name="YIM" maxlength="32" size="24" value="', $context['member']['yim']['name'], '" /></td>
</tr><tr>

Add after:

<td width="40%"><b>Skype Name: </b><div class="smalltext">Your Skype internet call name.</div></td>
<td><input type="text" name="Skype" size="24" value="', $context['member']['skype']['name'], '" /></td>
</tr><tr>
<td width="40%"><b>Ventrilo IP: </b><div class="smalltext">Your Ventrilo IP.</div></td>
<td><input type="text" name="Ventrilo" maxlength="65" size="24" value="', $context['member']['Ventrilo']['name'], '" /></td>
</tr><tr>

In the Sources directory:

In load.php:

Find:

mem.birthdate, mem.memberIP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,

Replace:

mem.birthdate, mem.memberIP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.Skype, mem.Ventrilo, mem.posts, mem.lastLogin,

Find:

mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.karmaGood,

Replace

mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.Skype, mem.Ventrilo, mem.posts, mem.lastLogin, mem.karmaGood,

Find:

'link' => '<a href="http://members.msn.com/' . $profile['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $profile['MSN'] . '" border="0" /></a>',

Add after:

'Skype' => $profile['Skype'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['Skype'],
'href' => 'callto://' . $profile['Skype'],
'link' => '<a href="callto://' . $profile['Skype'] . '"><img src="http://mystatus.skype.com/smallicon/' . $profile['Skype'] . '" alt="' . $profile['Skype'] . '" border="0" /></a>',
'link_text' => '<a href="callto://' . $profile['Skype'] . '">' . $profile['Skype'] . '</a>'
) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),
'Ventrilo' => $profile['Ventrilo'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['Ventrilo'],
'href' => 'ventrilo://' . $profile['Ventrilo'],
'link' => '<a href="ventrilo://' . $profile['Ventrilo'] . '"><img border="0" src="' . $settings['images_url'] . '/Ventrilo.gif"></a>',
'link_text' => '<a href="ventrilo://' . $profile['Ventrilo'] . '">' . $profile['Ventrilo'] . '</a>'
) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),

In memberlist.php:

Find:

'MSN' => array(
'label' => $txt['MSN'],
'width' => '25'
),

Add after:

'Skype' => array(
'label' => Skype,
'width' => '25'
),
'Ventrilo' => array(
'label' => Ventrilo,
'width' => '25'
),

Find:

'MSN' => array(
'down' => 'LENGTH(mem.MSN) > 0 DESC, ISNULL(mem.MSN) ASC, mem.MSN ASC',
'up' => 'LENGTH(mem.MSN) > 0 ASC, ISNULL(mem.MSN) DESC, mem.MSN DESC'
),

Add after:

'Skype' => array(
'down' => 'LENGTH(mem.Skype) > 0 DESC, ISNULL(mem.Skype) ASC, mem.Skype ASC',
'up' => 'LENGTH(mem.Skype) > 0 ASC, ISNULL(mem.Skype) DESC, mem.Skype DESC'
),

'Ventrilo' => array(
'down' => 'LENGTH(mem.Ventrilo) > 0 DESC, ISNULL(mem.Ventrilo) ASC, mem.Ventrilo ASC',
'up' => 'LENGTH(mem.Ventrilo) > 0 ASC, ISNULL(mem.Ventrilo) DESC, mem.Ventrilo DESC'
),

Find:
[code]
$fields += array(3 => 'MSN', 'AIM', 'ICQ', 'YIM');

Replace:

$fields += array(3 => 'MSN', 'AIM', 'ICQ', 'YIM', 'Skype', 'Ventrilo');

In profile.php:

Find:

'msn' => array('name' => empty($user_profile[$memID]['MSN']) ? '' : $user_profile[$memID]['MSN']),

Add after:

'skype' => array('name' => empty($user_profile[$memID]['Skype']) ? '' : $user_profile[$memID]['Skype']),
'Ventrilo' => array('name' => empty($user_profile[$memID]['Ventrilo']) ? '' : $user_profile[$memID]['Ventrilo']),

Find:

$profile_strings = array(
'websiteUrl', 'websiteTitle',
'AIM', 'YIM',

Replace:

$profile_strings = array(
'websiteUrl', 'websiteTitle',
'AIM', 'YIM', 'Skype', 'Ventrilo',

Find:

// Fix the spaces in messenger screennames...
$fix_spaces = array('MSN', 'AIM', 'YIM');

Replace:

// Fix the spaces in messenger screennames...
$fix_spaces = array('MSN', 'AIM', 'YIM', 'Skype', 'Ventrilo');

Find:

'msn' => array(
'name' => empty($_POST['msn']) ? '' : stripslashes($_POST['MSN'])
),

Add after:

'skype' => array(
'name' => empty($_POST['Skype']) ? '' : stripslashes($_POST['Skype'])
),
'Ventrilo' => array(
'name' => empty($_POST['Ventrilo']) ? '' : stripslashes($_POST['Ventrilo'])
),

Now for the faint hearted :)

You have to add two fields to your database using phpmyadmin or phpflashmyadmin.

in the table smf_members add two fields:

Skype as type tinytext
Ventrilo as type varchar with a size of 65.

Note the case has to be exact or it will not work.

the only error i have seen is that with the Skype field in the profile.  If you enter the skype name in the field and submit, the field clears, but the info is saved in the database and the icons show up everywhere they need to be...just that the profile field stays empty (anyone have any ideas that would fix this please tell me).

A special thanks to Oldiesman in helping me figure this out.  I also got some of the code for Skype from this post: http://www.simplemachines.org/community/index.php?topic=38550.0;topicseen

Skype provides it's own image now...for ventrilo:



[/code]
Don't tell me to get into shape...I have a shape...It is round!


TechnoDragon

I would appreciate it if some one could help me out with two things on this...

1.  How can I make this into a mod? Believe i have that done...

2. What is the way to create the DB query to add the fields in the database so it does not have to be done manually (especially if this gets turned inot a mod). <---anyone please help me on this?
Don't tell me to get into shape...I have a shape...It is round!


redlabour

http://www.politikstube.de - die christliche Politikcommunity

TechnoDragon

I have been desperately trying to get help to do just that, but noone has yet offered.  I know it is a bit daunting when you look at it, trust me I know...I had to do it twice.  Once to install it, then again to do this tutorial.
Don't tell me to get into shape...I have a shape...It is round!


redlabour

Hi,

i think in the Year 2006 it is absolutely unnecessary to lost Time on manually edit so much Code for a small Feature like Skype. Every great Boardsoftware has a Hook and Plugin System today to hold the original Code and Templates clean & secure.

I think a lot of People will thank you for your work but i am a little bit shocked.  ;)

I hope you do not misunderstand me - i mean this friendly but a little bit amused. ;)

Sorry for my poor english.
http://www.politikstube.de - die christliche Politikcommunity

TechnoDragon

No, I understand, there is a much easier way to put the skype icon in...just do a search for skype and you'll find it...it is just that mine is long because I wanted it to actually be "in" the forum, just like MSN and ICQ...the other method you'll find does not.

If only I could find someone who'll help me build a mod package we'd be good to go...
Don't tell me to get into shape...I have a shape...It is round!


redlabour

http://www.politikstube.de - die christliche Politikcommunity

Gary

Hmm...

* AwwLilMaggie  makes a mental note to put this into my forum
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

Kindred

suggestion:

Download and take a look at some other mod that modifies the database (like Globalopper's Member Map mod, or my Jack's Phat Calendar Pack, or any of a dozen others...)   and see how they do it in the install XML and the code to run the add-table...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

TechnoDragon

I have done that...and I think I have the mod part finished...it is the DB query that I cannot figure out...

http://www.technodragon.net/files/skypeventrilo.zip

If someone could take a look and make sure...just need help with the db query I think now.
Don't tell me to get into shape...I have a shape...It is round!


nokonium

I have it installed now I need to go and play

Thanks

Though when I checked the syntax I found a couple of errors

QuoteFind:
Code:
// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.

Replace:

Code:
// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js">
</script>

Needs to end
Quote</script> ';

Quote
'link' => '<a href="http://members.msn.com/'; . $profile['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $profile['MSN'] . '" border="0" /></a>',

should include the following line:
Quote) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),

before you <add after>




JayBachatero

technodragon73 take a look at Package SDK, anyone?.  There is a file called addsettings.php it tells you how to add the queries.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

TechnoDragon

Thank you so very much...that info was exactly what I needed (wish someone had pointed that out weeks ago).

I believe I have  a successful mod package now...since I do not know how to make it available as a mod here, here is the link to download it:

http://www.technodragon.net/files/skypeventrilo.zip

This is ONLY for RC2...modify earlier versions at your own risk.
Don't tell me to get into shape...I have a shape...It is round!


Gary

Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

TechnoDragon

Quote from: nokonium on February 28, 2006, 05:55:11 PM
I have it installed now I need to go and play

Thanks

Though when I checked the syntax I found a couple of errors

QuoteFind:
Code:
// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.

Replace:

Code:
// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js">
</script>

Needs to end
Quote</script> ';



Quote
'link' => '<a href="http://members.msn.com/'; . $profile['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $profile['MSN'] . '" border="0" /></a>',

should include the following line:
Quote) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),

before you <add after>


First part:
No, in the default theme there are two other lines below the echo statement (at least on mine there is) and the last line is escaped with ';
Second part:
I did not catch that...thank you...I fixed it and reuploaded the zip to my server.

I thank you for showing me the upload for packages...now if anyone could let me know if the mod works...it is my first after all...
Don't tell me to get into shape...I have a shape...It is round!


Georges

Hi Technodragon73,

Thank you for this tutorial.
I used the manual way as I was interested in seeing which part of the screen display was linked to a specific php script.
All is going fine except the Skype name disappearing from the profile as you mentioned it.
Did you find the trick to correct this behavior?

TechnoDragon

Not at the moment, but it seems to be an issue that is on each machine locally...as now my profile at my forum shows the skype and ventrilo name peoperly like it should...
Don't tell me to get into shape...I have a shape...It is round!


Georges

I install only the Skype icon and yes it shows properly.

1- Skype
BTW you need Skype 2.0 version and set properly the Tools-Privacy-Allow my status to be show on the web in order the icon can display your real status.
If you need a more explicit Skype icon in load.php
Find:
<img src="http://mystatus.skype.com/smallicon/'
Change:
<img src="http://mystatus.skype.com/smallclassic/'

I note too that reloading the MEMBERS do not refresh the page and the Skype icon does not change despite the Skype status of the member has effectively changed.

2- Profile
The problem with the Skype Name not showing in the profile is when the member will update his profile. If nothing is entered again into the Skype Name box then it will be blank in the Data Base.

May be something related to the $context['member']['Skype']['name'] variable not declared correctly?
I am in the process of modifying the Profile in order to get more personal information from the members as company, phone, fax, address etc... (it is a private forum) and the Skype Name issue should be solved before to go ahead with this small project.
I am newbie to PHP and SMF so I have to rely on help from the experts!


Georges

Hi Technodragon73,

It seems I have found the profile update problem:

In Profile.php
You write:
'Skype' => array('name' => empty($user_profile[$memID]['Skype'])
'Skype' => array(
'name' => empty($_POST['Skype']) ? '' : stripslashes($_POST['Skype'])


You should write:
'skype' => array('name' => empty($user_profile[$memID]['Skype'])
'skype' => array(
'name' => empty($_POST['Skype']) ? '' : stripslashes($_POST['Skype'])


Skype is the DB field but skype is the variable.

TechnoDragon

Thank you for that bit of info...I am still very new to all of this php stuff and I am finding case can really affect teh context of things...I will update this tutorial as soon as I can.
Don't tell me to get into shape...I have a shape...It is round!


Advertisement: