Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 06:05 am EDT

Geeklog Forums

AIM Presence Block


Status: offline

mst3kroqs

Forum User
Regular Poster
Registered: 10/18/05
Posts: 78
Location:Cary, NC USA
Salutations -

Everyone knows that using AIM will lead to a full and better life. GeekLog has equally beneficial effects.

Using them together is way fun, and so here is an block which will allow you to display the current online status of 1-N users in a block on your site.

I've clipped the comments from the code comment block so you can read them easier.

In order to make this hairball work you have to do a few things:

1) Visit AIM and register with them for a key which will provide you the ability to retrieve presence (online/offline, etc.) information from their site for any given user

As of this writing, the link was:

http://www.aim.com/presence/main.adp?aolp=0

Set the $aimkey var below with this value

2) Make an 'aim' subdirectory under public_htmlimages and install AIM status icons.

These icons can be found at the following url's:

online icon: http://cdn.digitalcity.com/presence/online.gif
offline icon: http://cdn.digitalcity.com/presence/offline.gif
away icon: http://cdn.digitalcity.com/presence/away.gif
idle icon: http://cdn.digitalcity.com/presence/idle.gif
mobile icon: http://cdn.digitalcity.com/presence/mobile.gif

3) Put some username/screennames in the $users array below. Note that the first value is the display name of the user, and the second is the their screenname

4) Install this function code in system/lib-custom.php

5) Use block manager to make a block:

A) Title "Who's On AIM? (or whatever you like)
Cool Block Name: "aim_presence" (or something unique, with no spaces)
C) Topic of your choice (I use All)
D) Side & block order of your choice
E) Type: 'PHP Block'
F) Block Function: phpblock_aimpresence

6) Note that you can control whether this block displays for anonymous and/or registered users by setting the appropriate 'Members' and 'Anonymous' Read rights at the bottom of the page.

7) Save, and enjoy!

Here's the code:

Text Formatted Code

function phpblock_aimpresence()
{
    global $_CONF;
   
    $aimkey = "th1s1sn0trealgetUR0wn";
    $imgurl = $_CONF['site_url'] . "/images/aim";
    $users = array(
        array("User1","notarealname"),
        array("User2","notrealeither"),
        array("User3","againnotreal")
        );
         
    $retval = "<table>n";
    for( $i=0; $i < count( $users ); $i++ ) {
        $retval .= "<tr>n"
            ."<td align="right">{$users[$i][0]} </td>"
            ."<td align="center"><a href="aim:GoIM?screenname={$users[$i][1]}">"
            ."<img alt="" src="http://api.oscar.aol.com/SOA/key={$aimkey}/presence/{$users[$i][1]}" "
            ."border="0"></a></td>n"
            ."<td align="left"> <a href="aim:GoIM?screenname={$users[$i][1]}">"
            ."{$users[$i][1]}</a></td>n"
            ."</tr>n";
    }                  
    $retval .= "</table>n";

    $retval .= "<br><center><table>n"
        ."<tr><td colspan=2 align="left"><b>Status Key</b> </td>"
        ."<td><img alt="" src="{$imgurl}/online.gif" border="0"</td>"
        ."<td align="left"> - Online</td></tr>n"
        ."<tr><td><img alt="" src="{$imgurl}/idle.gif" border="0"</td>"
        ."<td align="left"> - Idle </td>n"
        ."<td><img alt="" src="{$imgurl}/offline.gif" border="0"</td>"
        ."<td align="left"> - Offline</td></tr>n"
        ."<tr><td><img alt="" src="{$imgurl}/away.gif" border="0"</td>"
        ."<td align="left"> - Away </td>n"
        ."<td><img alt="" src="{$imgurl}/mobile.gif" border="0"</td>"
        ."<td align="left"> - Mobile</td></tr>n"
        ."</table></center>n";

                     
    return $retval;  
}

 

Enjoy!
 Quote

SirDuke

Anonymous
Sounds pretty nifty. Any url to see it in action?
 Quote

Status: offline

mst3kroqs

Forum User
Regular Poster
Registered: 10/18/05
Posts: 78
Location:Cary, NC USA
Sure, try this.
 Quote

SirDuke

Anonymous
nice
 Quote

Status: offline

greenteagod

Forum User
Junior
Registered: 04/08/07
Posts: 19
I am attempting to install this block; however, it seems to break my site at every attempt to add the code. Is there a specific place in the lib-custom file that this code should be added?
 Quote

Status: offline

mst3kroqs

Forum User
Regular Poster
Registered: 10/18/05
Posts: 78
Location:Cary, NC USA
Hi -

Position is not important, but probably the easist way to ensure that you have a clean installation is to insert it somewhere between the right brace "}" that closes the last function, and the "?>" which terminates the file.

Sometimes, folks mistakenly overwrite the "?>" at the end with the code, that has to be included to properly terminate the PHP script for the interpreter.
 Quote

All times are EDT. The time is now 06:05 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content