Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • The same of course applies to /wp-admin/load-scripts.php.

    Comment out lines 130-139 to get the JavaScript for the admin pages working.

    /*if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
    	header('Vary: Accept-Encoding'); // Handle proxies
    	if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
    		header('Content-Encoding: deflate');
    		$out = gzdeflate( $out, 3 );
    	} elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
    		header('Content-Encoding: gzip');
    		$out = gzencode( $out, 3 );
    	}
    }*/

    Hello

    I’m using WPMU 2.8.6 and I’ve found that the source of the problem for me was compression of the output.

    The quickfix: comment out lines 140-149 in /wp-admin/load-styles.php.

    /*if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
    	header('Vary: Accept-Encoding'); // Handle proxies
    	if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
    		header('Content-Encoding: deflate');
    		$out = gzdeflate( $out, 3 );
    	} elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
    		header('Content-Encoding: gzip');
    		$out = gzencode( $out, 3 );
    	}
    }*/

    By commenting out line 8 Firefox gives an error of faulty compression.
    //error_reporting(0);

    My ZLib in PHP should be workning but something goes wrong here. So this is the correct fix for me.

    Correction; my previous funtion doesn’t order by date the way intended.

    function last_post_per_user()
    {
    	global $wpdb;
    
    	return $wpdb->get_results('SELECT post_author, post_title FROM '.$wpdb->posts.' INNER JOIN (SELECT MAX(ID) AS id FROM '.$wpdb->posts.' WHERE post_status=\'publish\' AND post_type=\'post\' AND post_author!=\'1\' GROUP BY post_author) latest ON wp_1_posts.ID = latest.id');
    }

    This SQL statement returns one item per author, sorted by the highest post ID for that user.

    Just thought I would share my edit of this code which is more optimized.

    function last_post_per_user()
    {
    	global $wpdb;
    
    	return $wpdb->get_results('SELECT post_author, post_title FROM '.$wpdb->posts.' WHERE post_status=\'publish\' AND post_type=\'post\' AND post_author!=\'1\' GROUP BY post_author ORDER BY post_date DESC');
    }

    This collects one post per author ordered by the post’s date.
    The GROUP BY attribute in SQL is the magic thing here.

    Then all that’s needed is an associative loop.

    $posts = last_post_per_user();
    
    foreach ($posts as $post)
    {
    	// Code goes here, $post contains the post variables post_author and post_title (which was what I needed for this).
    	echo $post->post_title,'<br />';
    }
Viewing 4 replies - 1 through 4 (of 4 total)