Show Your Gtalk Presence on WordPress
I couldn’t find a plugin that showed my presence in a way that I liked so I threw together the following php script. Its influenced by the Gtalk (Status) to WordPress (G2W) plugin by Aw Guo. It includes simplehtmldom, a very easy to use HTML DOM parser.
The first step is to get a Gtalk Chatback Badge. Edit the badge, making sure “Show your status message” is ticked. Copy the hashcode in the url of your badge. Its the string after after “?tk”. Replace “HASHCODE” in the following code with your hashcode.
include './simplehtmldom/simple_html_dom.php';
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/talk/service/badge/Show?tk=HASHCODE');
foreach($html->find('img#b') as $element){
$status['image']='';
$status['type']=$element->alt;
}
$status['text']=preg_replace("/[^a-zA-Z0-9s t]/", "", $html->find('div.r', 1)->plaintext) ;
//print_r($status);
echo $status['image']." ".$status['text'];
?>
Add the following to the page where you want to show your status.