Welcome to Geeklog, Anonymous Tuesday, June 25 2024 @ 02:04 am EDT

Geeklog Forums

AIM Presence Block

Status: offline


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:


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(
    $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]}" "
            ."<td align="left"> <a href="aim:GoIM?screenname={$users[$i][1]}">"
    $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"

    return $retval;  




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

Status: offline


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



Status: offline


Forum User
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?

Status: offline


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.

All times are EDT. The time is now 02:04 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