The MU forums have moved to WordPress.org

Suggetion: List All [Blogs - Posts - Themes - Plugins - Comment] (6 posts)

  1. MazZziKa
    Member
    Posted 15 years ago #

    List All for
    * Blogs
    * Posts (a list or full post)
    * Themes
    * Plugins
    * Comment
    Filters[asending - desending]
    Cat ,Tag, Rate , Time updated , Click , Featured

    .. it will be great if each can add as a page
    .. please .. admin option page

    .. please all suggest anything u see it will help improve this important plugin

  2. andrea_r
    Moderator
    Posted 15 years ago #

  3. MazZziKa
    Member
    Posted 15 years ago #

    premium.wpmudev.com .. i am searching for free plugins

  4. andrea_r
    Moderator
    Posted 15 years ago #

    There's still free options for all, just not all in one.

    List All for
    * Blogs - out there as "List all"
    * Posts (a list or full post) - see sitewide feed or most recent post and even (I think ) list all does posts too.
    * Themes - been done.
    * Plugins - there's one out there for regular wordpress.
    * Comment - use the sitewidefeed plugin, it has a comments feed.

  5. phlux0r
    Member
    Posted 15 years ago #

    Hey here's a lil function I just wrote for my project that extends the default get_blog_list() function with some features. You can add more to it if you like. The Comments should be self-explanatory. Drop it in your theme's functions.php and use in theme :).

    Usage example:
    $blogs = my_get_blog_list("include_latest_post=1&most_active=1&blog_ids=1,3,4", 0, 'all');

    /**
     * Extends the wpmu get_blog_list function with more options and parameters
     *
     * the args are:
     * blog_ids - a comma separated list of blog ids that should be retrieved
     * orderby - the column in the blogs table to order by. ie: registered, last_updated, domain, path, blog_id
     * order - ASC or DESC
     * include_latest_posts - 0 or 1 whether you want to include the latest post from the corresponding blog in the return
     * exclude_blog_ids - a comma separated list of blog ids that should be excluded from the result
     * most_active - 0 or 1 - if 1 then order the blog list by most active blogs first
     *
     * The return array contains:
     * 'blog_id', 'domain', 'path', 'postcount' and if include_latest_post is specified,
     * 'latestpost' set to the latest post object from that blog
     *
     * @param mixed $args Standard WP args parameter. string or array
     * @param int $start The start index - default 0
     * @param mixed $num the end index or 'all'
     * @return array The list of blogs
     */
    function my_get_blog_list( $args, $start = 0, $num = 10 ) {
    	global $wpdb;
    	$defaults = array(
    		'blog_ids' => '','orderby' => 'registered','order' => 'DESC',
    		'include_latest_post' => 0,'exclude_blog_ids' => '','most_active' => 0
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    
    	// get the values from the array into args (keys will be vars)
    	extract( $r );
    
    	// set up the query for our blog list depending on the passed parameters
    	$query = "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = '$wpdb->siteid' AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'";
    	if ($blog_ids) {
    		$query .= " AND blog_id in (".$blog_ids.")";
    	}
    	if ($exclude_blog_ids) {
    		$query .= " AND blog_id not in (".$exclude_blog_ids.")";
    	}
    	$query .= " ORDER BY ".$orderby." ".$order;
    	unset( $blogs );
    	$blogs = $wpdb->get_results( $query, ARRAY_A );
    
    	// go through the blog results and fetch some more data like postcount and latest post if parameter set
    	foreach ( (array) $blogs as $details ) {
    		$blog_list[ $details['blog_id'] ] = $details;
    		$blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT count(*) FROM " . $wpdb->base_prefix . $details['blog_id'] . "_posts WHERE post_status='publish' AND post_type='post'" );
    		if ($include_latest_post && $blog_list[ $details['blog_id'] ]['postcount'] > 0) {
    			$blog_list[ $details['blog_id'] ]['latestpost'] = $wpdb->get_row( "SELECT * FROM " . $wpdb->base_prefix . $details['blog_id'] . "_posts WHERE post_status='publish' AND post_type='post' ORDER BY post_date DESC LIMIT 1" );
    		}
    	}
    	unset( $blogs );
    	$blogs = $blog_list;
    	// see if we want the most active blogs
    	if ($most_active) {
    		if( is_array( $blogs ) ) {
    			reset( $blogs );
    			foreach ( (array) $blogs as $key => $details ) {
    				$most_active_blogs[ $details['blog_id'] ] = $details['postcount'];
    				$blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
    			}
    			arsort( $most_active_blogs );
    			reset( $most_active_blogs );
    			foreach ( (array) $most_active_blogs as $key => $details ) {
    				$t[ $key ] = $blog_list[ $key ];
    			}
    			unset( $most_active_blogs );
    			$most_active_blogs = $t;
    		}
    		unset( $blogs );
    		$blogs = $most_active_blogs;
    	}
    	// see if we want all blogs or just a subset
    	if ($num == 'all') {
    		return array_slice( $blogs, $start, count($blogs) );
    	} else {
    		return array_slice( $blogs, $start, $num );
    	}
    }
  6. dsader
    Member
    Posted 15 years ago #

About this Topic