TinyPortal

Development => Block Codes => Topic started by: alhaudhie on December 16, 2009, 04:36:08 PM

Title: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 04:36:08 PM
TP 1.0.4

SMF 1.1.10

Adding YIM icon in user online block.

How can we add (https://www.tinyportal.net/Themes/ganymedes/images/yim.gif)

side of username in online user list...?

like when user is On their YIM the icon
(https://www.tinyportal.net/Themes/ganymedes/images/yim.gif)Mrcare
is showing side their name and other user can cliick to go for YM or yahoo instant web massengger.

i have try to edit the code in TPBlocks.template.php like
$online = ssi_whosOnline('array');    
           echo $bullet.$txt['tp-users'].': '.$online['num_users'];    
           echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];    
           echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>5 ? 'height: 32ex;overflow: auto;' : '' ,'">';       

   foreach($online['users'] as $user)
{

if ($message['member']['yim']['href'])
echo '
<a href="', $message['member']['yim']['href'], '" target="_blank"><img src="' . $settings['images_url'] . '/yim.gif" border="0" /></a>';
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
}
echo '
</div>';
}
echo '</div>';
}

but there is nothing... tq.
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 05:30:14 PM
Where are you getting the $message array from ?
Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 05:39:08 PM
Quote from: freddy888 on December 16, 2009, 05:30:14 PM
Where are you getting the $message array from ?

i get it from display.template.php
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 05:45:57 PM
You can't just add in a reference to an array wherever you like - the array needs to be loaded some place first.  Your array is going to be empty because ssi_whosOnline does not load up your $message array.  So that is why it doesn't work.

I would go and edit the ssi_whosOnline.php and add the YIM field to it's output.  Then you can check it like this :

if ($user['YIM'])
{
      ...display the icon and link...
}
Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 06:12:12 PM
i have tried it like
foreach($online['users'] as $user)
      {
         
     if ($user['YIM'])

          echo '
                                    <a href="', $message['member']['yim']['href'], '" target="_blank"><img src="' . $settings['images_url'] . '/yim.gif" border="0" /></a>';
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
         echo '<br />';
   
}


but nothing change..
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 06:13:36 PM
Did you do what I suggested with the ssi_whosOnline.php ?

You still have a reference to $message in there too...
Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 06:19:00 PM
Quote from: freddy888 on December 16, 2009, 06:13:36 PM
Did you do what I suggested with the ssi_whosOnline.php ?

You still have a reference to $message in there too...

oh.. sorry... i edit the wrong file..
Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 06:24:03 PM
nothing change..

// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
//ym
if ($user['YIM'])
{
          echo '
                                    <a href="', $message['member']['yim']['href'], '" target="_blank"><img src="' . $settings['images_url'] . '/yim.gif" border="0" /></a>';
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
         echo '<br />';
   
}   
// Bold any buddies.
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 06:46:16 PM
I said to add the field YIM to the output of the array.... and why are you using the $message array again ?

Please read what I say carefully...

Do you want me to do this for you if you are stuck ?
Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 06:48:42 PM
 :laugh:

Quote from: freddy888 on December 16, 2009, 06:46:16 PM
I said to add the field YIM to the output of the array.... and why are you using the $message array again ?

Please read what I say carefully...

Do you want me to do this for you if you are stuck ?

yes... i dont know anything.. what i did is try and try and try...

hope u can tell step by step.. tq
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 06:55:04 PM
 ;D  That's a good thing my friend.

Leave it with me and I will set you straight !

Back in a bit....
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 07:30:31 PM
First you need to get the YIM field added so...

In SSI.php, find the ssi_whosOnline function.

Find :


SELECT
        lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
        mg.onlineColor, mg.ID_GROUP

         
Change to :

SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, YIM

         
Find :


$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);

         
Change to :


$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
'YIM' => $row['YIM'],
);

         
=============================================


Now going back to your code that you first posted.  It needs to be rearranged something like this :

So change this bit :

if ($message['member']['yim']['href'])
echo '
<a href="', $message['member']['yim']['href'], '" target="_blank"><img src="' . $settings['images_url'] . '/yim.gif" border="0" /></a>';
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';


To this :
   

if ($user['YIM'])
$user['link'] = '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $user['YIM'] . '" target="_blank"><img src="' . $settings['images_url'] . '/yim.gif" border="0" /></a>' . $user['link'];

echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';

   
That should do it.

Title: Re: Adding YIM icon
Post by: alhaudhie on December 16, 2009, 07:43:00 PM
 O0 :2funny:

ehehe

thats veryy cooolll..
tq for helps.
Title: Re: Adding YIM icon
Post by: Freddy on December 16, 2009, 07:45:25 PM
No problem :)
Title: Re: Adding YIM icon
Post by: ccbtimewizard on December 18, 2009, 03:13:45 AM
QuoteSELECT
   lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
   mg.onlineColor, mg.ID_GROUP, YIM

It should be:

SELECT
   lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
   mg.onlineColor, mg.ID_GROUP, mem.YIM
Title: Re: Adding YIM icon
Post by: Freddy on December 18, 2009, 01:06:01 PM
Yeah that is more correct, but it would still work.  Thanks for pointing it out  :)