How to reset static $buddies-variable

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
macco's picture

Hello,

how can I reset the static $buddies-variable before I use the buddy_api_get_buddies():

<?php
function buddy_api_get_buddies($op = 'uid', $uid = NULL) {

  static
$buddies; // I MEAN THIS !!!!!

 
if (!$uid) {
    global
$user;
   
$uid = $user->uid;
  }
  if (!isset(
$buddies[$op][$uid])) {
   
$buddies[$op][$uid] = array();
   
$sql = 'SELECT u.uid, u.name, b.buddy FROM {buddylist} b
            INNER JOIN {users} u ON b.buddy = u.uid
            WHERE b.uid = %d AND u.status = 1'
;
   
$result = db_query($sql, $uid);
    while (
$row = db_fetch_object($result)) {  
      if (
$op == 'uid') {
       
$buddies[$op][$uid][$row->buddy] = $row->name;
      }
      else if(
$op == 'object') {
       
$buddies[$op][$uid][$row->buddy] = user_load(array('uid' => $row->buddy));
      }    
    }
  }
  return
$buddies[$op][$uid];
}
?>

Regards,
macco