mysite_type_blog_clear

Definition

mysite_type_blog_clear($type)
plugins/types/blog.inc, line 236

Description

Implements mysite_type_hook_clear().

Code

function mysite_type_blog_clear($type) {
  // fetch all the active records of this type and see if they really exist in the proper table
  $sql = "SELECT mid, uid, type_id, title FROM {mysite_data} WHERE type = '%s'";
  $result = db_query($sql, $type);
  $data = array();
  while ($item = db_fetch_array($result)) {
    $sql = "SELECT DISTINCT(u.uid) FROM {users} u INNER JOIN {node} n ON u.uid = n.uid WHERE n.status = 1 AND n.type = 'blog' AND u.uid = %d";
    $check = db_fetch_object(db_query($sql, $item['type_id']));
    if (empty($check->uid)) {
      $data[$item['mid']]  = $item;
    }
  }
  return $data;
}