TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

July 16, 2024, 09:04:12 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,319
  • Total Topics: 21,233
  • Online today: 79
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 44
  • Total: 44

Adding YIM icon

Started by alhaudhie, December 16, 2009, 04:36:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alhaudhie

TP 1.0.4

SMF 1.1.10

Adding YIM icon in user online block.

How can we add

side of username in online user list...?

like when user is On their YIM the icon
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.

Freddy

Where are you getting the $message array from ?

alhaudhie

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

Freddy

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...
}

alhaudhie

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..

Freddy

Did you do what I suggested with the ssi_whosOnline.php ?

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

alhaudhie

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..

alhaudhie

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.

Freddy

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 ?

alhaudhie

 :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

Freddy

 ;D  That's a good thing my friend.

Leave it with me and I will set you straight !

Back in a bit....

Freddy

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.


alhaudhie

 O0 :2funny:

ehehe

thats veryy cooolll..
tq for helps.

Freddy


ccbtimewizard

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

Freddy

Yeah that is more correct, but it would still work.  Thanks for pointing it out  :)