query(" CREATE TEMPORARY TABLE bloginfo SELECT $wpdb->blogs.id, $wpdb->blogs.slug, option_value as blogname, status FROM $wpdb->blogs INNER JOIN $wpdb->options ON ($wpdb->blogs.id = $wpdb->options.blog) INNER JOIN $wpdb->posts INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID) INNER JOIN $wpdb->categories ON (category_id = cat_ID AND $wpdb->categories.blog = $wpdb->options.blog) WHERE status = 'active' AND option_name = 'blogname' ORDER BY post_date_gmt DESC "); $blogs = $wpdb->get_results("SELECT DISTINCT(id), slug, blogname, status FROM bloginfo"); echo $before_title . $title . $after_title . "" . $after_widget; } // This is the function that outputs the form to let users edit // the widget's title and so on. It's an optional feature, but // we'll use it because we can! function widget_allblogs_control() { // Collect our widget's options. $options = get_option('widget_allblogs'); // This is for handing the control form submission. if ( $_POST['allblogs-submit'] ) { // Clean up control form submission options $newoptions['title'] = strip_tags(stripslashes($_POST['allblogs-title'])); $newoptions['text'] = strip_tags(stripslashes($_POST['allblogs-text'])); } // If original widget options do not match control form // submission options, update them. if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_allblogs', $options); } // Format options as valid HTML. Hey, why not. $title = htmlspecialchars($options['title'], ENT_QUOTES); $text = htmlspecialchars($options['text'], ENT_QUOTES); // The HTML below is the control form for editing options. ?>