The MU forums have moved to WordPress.org

List All Plugin! Strange problem (13 posts)

  1. kishorebudha
    Member
    Posted 15 years ago #

    Hi,

    I have set up my homepage to use list all plugin. http://subalterncinema.com

    However, you will notice that the blog name incorporate's a slash, like this:

    Docedge '07: Lessons for Indian documentary filmmakers - Posted to kishore\'s blog by Kishore

    How do I remove it please?

  2. drmike
    Member
    Posted 15 years ago #

    What version of the plugin are you running? Sounds like an older one as Andrew fixed this issue a while back.

  3. kishorebudha
    Member
    Posted 15 years ago #

    I am using the latest version available on the WPMUDEV.org site.

  4. kishorebudha
    Member
    Posted 15 years ago #

    Also noticed that the database stores the blog name with a slash. For example, in table wp_2_options the field blogname stores the value kishore's blog as kishore\'s blog.

    Is that normal?

  5. kishorebudha
    Member
    Posted 15 years ago #

    In fact even the site http://homeschooljournal.net/ has the same problem.

    # Ahhh, the finer things in life.... by Squid\'s Word

  6. andrewbillits
    Member
    Posted 15 years ago #

    hmm, i'm not sure what would be causing that and I don't have the time to hunt it down right this second.

    However a quick (temporary) fix would be to toss a string replace on the output data. Just replace \' with ' and you should be good to go.

  7. lunabyte
    Member
    Posted 15 years ago #

    ( or stick it in a strpslashes() )

  8. andrewbillits
    Member
    Posted 15 years ago #

    or that :P

  9. drmike
    Member
    Posted 15 years ago #

    It's strange though that it's not showing up over at http://daria.be and I dropped in 0.0.5 this morning. I'm not adding any code in.

  10. kishorebudha
    Member
    Posted 15 years ago #

    I am a PhP newbie - so please excuse this question but is this how the code is meant to be modified?

    $str=(list_all_wpmu_posts(10, 100, '', '', '', '','show','show','show'));
    echo stripslashes($str);

  11. andrea_r
    Moderator
    Posted 15 years ago #

    Great, another to-do on my list. :)

  12. andrewbillits
    Member
    Posted 15 years ago #

    nah, kishore sent me the code to fix the plugin (saved me some time) and i'll have a new release up later today.

  13. kishorebudha
    Member
    Posted 15 years ago #

    Andrea -- I noted that your plugin (http://atypicalhomeschool.net/wordpress-plugins/ah-recent-posts-mu.txt) too output's the slash. I have fixed that as well. Here is the modified version (NOTE THAT I HAVE ADDED THE CLASS "boldfora" TO OUTPUT THE HEADLINE IN BOLD. Users can remove the css reference or create one in their CSS.)

    /*
    Plugin Name: WordPress MU Recent Posts
    Plugin URI: http://atypicalhomeschool.net/wordpress-plugins/
    Description: Retrieves a list of the most recent posts in a WordPress MU installation. Based on (Andrea - fill this in)
    Version: 0.3
    Author: Ron Rennick
    Author URI: http://atypicalhomeschool.net/

    Use this by pasting the following wherever you want it to show:
    <?php ah_recent_posts_mu(10) ?>

    */

    function ah_recent_posts_mu($how_many = 10) {
    global $wpdb;
    $counter = 0;
    // get a list of blogs in order of most recent update
    $blogs = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs WHERE
    last_updated >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
    ORDER BY last_updated DESC");

    if ($blogs) {
    foreach ($blogs as $blog) {
    // we need _posts and _options tables for this to work
    $blogOptionsTable = "wp_".$blog."_options";
    $blogPostsTable = "wp_".$blog."_posts";
    $options = $wpdb->get_results("SELECT option_value FROM
    $blogOptionsTable WHERE option_name IN ('siteurl','blogname')
    ORDER BY option_name DESC");
    // we fetch the title and link for the latest post
    $thispost = $wpdb->get_results("SELECT post_title, guid
    FROM $blogPostsTable WHERE post_status = 'publish'
    AND post_type = 'post' AND post_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
    ORDER BY id DESC LIMIT 0,1");
    // if it is found put it to the output
    if($thispost) {
    echo '

  14. guid
    .'">'.$thispost[0]->post_title.'
    from <a href="'
    .$options[0]->option_value.'">'
    .stripslashes ($options[1]->option_value)."
  15. ";
    $counter++;
    }
    // don't go over the limit
    if($counter >= $how_many) {
    break;
    }
    }
    }
    }
    ?>

About this Topic