The MU forums have moved to WordPress.org

Recently Updated/Most Viewed listings (16 posts)

  1. emdee90
    Member
    Posted 18 years ago #

    I'm creating my own start page for mu.wordpress.

    I'd like to add a box that has the 'recently updated' and the 'most viewed' blogs. is this done thru server-side includes or is there another method that people are using?

    Thanks-

  2. samchng
    Member
    Posted 18 years ago #

    I know this,
    <?php get_most_active_blogs(); ?> for most active.

    Check out the functions from wpmu-functions.php for more.

  3. shredder
    Member
    Posted 18 years ago #

    Ah, a nice pointer there samchng, thanks!

    Curiously:

    <?php get_most_active_blogs(); ?>

    returns a bulleted list with a number (#entries) and the url for each blog

    whereas both
    <?php get_blog_list(); ?>
    and
    <?php get_last_updated(); ?>

    give no ouput at all?

    I would have expected some output? Any pointers?

  4. shredder
    Member
    Posted 18 years ago #

    <?php get_most_active_blogs(); ?>

    returns a bulleted list with a number (# of entries) and the full url for each blog

    Q.: is there a way to limit the visible output to just the sub-domain (whilst obviously maintaining a link to the blog/the full URI)?

  5. shredder
    Member
    Posted 18 years ago #

    neurone has just posted a link to the plugin 'List All' in another thread:

    http://mu.wordpress.org/forums/topic.php?id=949&replies=3
    (topic similar to this one)

    The full link to the plugin is:

    http://wpmudevorg.wordpress.com/project/List-All

    it offers some of the options emdee90 is looking for (as I am too)

  6. emdee90
    Member
    Posted 18 years ago #

    Whenever I try to access wpmu-functions.php, I receive the following error:

    "Fatal error: Call to undefined function: add_action() in /home/.chardonnay/flyblog/flyblog.com/wp-inst/wp-includes/wpmu-functions.php on line 14"

  7. mirsasha
    Member
    Posted 18 years ago #

    The list all looks like it will solve one of the issues I'm having.

    Another one seems to have been asked but not quite answered here. I want the main page of my mu site to act as an aggregator of all my other mu blogs - so that it will show the title, excerpt, blog name it was posted to and "more" links for all the sub-blogs and the main blog. Essentially, it would kind of look like all the categories do on a single user WP blog.

    Does that make any sense? I'm not sure if the question is clear. If so, does anyone have code that will do this?

  8. SactoEric
    Member
    Posted 17 years ago #

    I'm drawing a blank... how do you use those & the List-All one linked to above? How would I get those to display on main front page of my site? (no luck w/ my RSS reader)

  9. andrea_r
    Moderator
    Posted 17 years ago #

    You edit your template to include the code. :)

  10. Trent
    Member
    Posted 17 years ago #

    I have setup the list all and list all posts plugins on my home.php page of my main site and can't get it to list any posts or blogs other than the main blog.

    My site is http://onvertigo.com

    I have it setup so the sites are created onvertigo.com/username/ because the subdomains wouldn't work on my server structure.

    I have only one other blog 'while testing' at http://onvertigo.com/trentadams/ and it still isn't coming up in the list.

    I have used the following code:

    <?php list_all_wpmu_blogs('100', 'name', '<p>', '</p>', 'updated'); ?>

    As well, even the most active doesn't bring up my other blog either.

    <?php get_most_active_blogs(); ?>

    I am really at a loss here and could use some help of someone knows how I could get this working.

    Thank you,

    Trent

  11. andrea_r
    Moderator
    Posted 17 years ago #

    You didn't mark the blogs as private did you?

  12. Trent
    Member
    Posted 17 years ago #

    hmm....where and when would I have been prompted to do that? If I managed to do it, how would I undo it?

    Trent

    ***Edit***

    I checked the options and it wasn't a public blog. Can't remember when I would have changed that. Is that the default (private) option or did I agree at some point?

  13. andrea_r
    Moderator
    Posted 17 years ago #

    It's at signup, a ticky box that is checked and you uncheck it if you do not want the blog to appear in google technorati, OR public listings around the site. :)

  14. Trent
    Member
    Posted 17 years ago #

    Thank you Andrea. I had to create a new blog just to find out what I did wrong. MU is a great product. Now I just have to wait for an invitation only plugin...:-)

    Trent

  15. zimen
    Member
    Posted 17 years ago #

    Still not perfect but this works for me:

    <?php
    //What blogs where last updated, lets grab a bunch at first.
    $blogs = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs WHERE public = 1 AND last_updated!='0000-00-00 00:00:00' ORDER BY last_updated DESC LIMIT 25");
    $tables = array();
    foreach ($blogs as $blog) {
    // we need _posts and _options tables for this to work
    $blogOptionsTable = "wp_".$blog."_options";
    $blogPostsTable = "wp_".$blog."_posts";
    $blogCatTable = "wp_".$blog."_post2cat";
    //add to array for later use
    $table = array ($blog, $blogPostsTable, $blogOptionsTable, $blogCatTable );
    $tables[] = $table; //push into tables
    }
    //now lets pull out 5 recent posts from each blog
    $postresults = array();
    foreach ($tables as $t) {
    $postitems = $wpdb->get_results("SELECT ID,post_title,guid,post_content,comment_count,post_date_gmt FROM $t[1] WHERE post_status = 'publish' AND post_type = 'post' AND guid != '' ORDER BY id DESC LIMIT 0,1");
    //push into array, had $postresults[] = $postitems;, but didn't work?
    foreach ($postitems as $postitem) {
    $col = array($postitem->ID,$postitem->post_title,$postitem->guid,$postitem->post_content,$postitem->comment_count,$postitem->post_date_gmt,$t[0]);
    $postresults[] = $col;
    }
    }
    function cmp($a,$b) {
    $at = strtotime($a[5]);
    $bt = strtotime($b[5]);
    if($at == $bt)
    return(0);
    if($at < $bt)
    return(1);
    else
    return(-1);
    }
    usort($postresults, 'cmp');
    foreach ($postresults as $postresult) {
    $siteurl = $wpdb->get_col("SELECT option_value FROM wp_". $postresult[6] ."_options WHERE option_name='siteurl'");
    $blogname = $wpdb->get_col("SELECT option_value FROM wp_". $postresult[6] ."_options WHERE option_name='blogname'");
    ?>
    <div class="entry">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><div class="entrytitle">
    <h2><a href="<?php echo $postresult[2]; ?>" rel="bookmark" title="Permanent Link to <?php echo $postresult[1]; ?>"><?php echo $postresult[1]; ?></a></h2>
    </div>
    <div id="entrybody">
    <?php
    $string = $postresult[3];
    $pos = strpos($string, "<!--more-->");
    if($pos === false) {
    echo $string;
    }else{
    echo substr($string, 0, $pos)."&nbsp;&nbsp;<a href=".$postresult[2] .">(More...)</a>";
    }
    ?>
    </div></td>
    </tr>
    </table>
    <div class="entrymeta">
    <div class="postinfo">
    <a href="<?php echo $siteurl[0]; ?>"><?php echo $blogname[0]; ?></a> | <a href="<?php echo $postresult[2]; ?>"><?php echo $postresult[4]; ?> comments &raquo; </a>
    </div>
    </div>
    </div>
    <?php } ?>

  16. wpmuuser
    Member
    Posted 16 years ago #

    A simpler way is:
    <?php
    $blogs = get_last_updated();
    if( is_array( $blogs ) ) {
    ?>

    <?php
    }
    ?>

About this Topic

  • Started 18 years ago by emdee90
  • Latest reply from wpmuuser