The MU forums have moved to WordPress.org

List all post in RC1 (3 posts)

  1. wep
    Member
    Posted 15 years ago #

    List all post (All plugins in RC1) bad work...
    In Title, read more, and comments no permalinks ...
    but yes... ?p=3

    In wpmu 1.3.3 yes work... in code guid but...

    is problem of RC1? Or plugins? like fix this?

  2. wep
    Member
    Posted 15 years ago #

    This code of new plugin all from wpmu ( show all post in frontpage) in WPMU RC1.5 no work, NO PERMALINKS IN COMMENTS, and TITLE why??? fix?? solution???

    $db_prefix = "wp"; //this is your database prefix, if your first user has wp_1_posts, then your prefix is "wp"
    $howmany = 7; //how many rows of results do you want back?
    $width = 50; //how wide do you want your rows?

    /********************************************************************/

    //i first tried pulling in every blog post by user, but then i lost all information about the default blog address. this became important when a guest
    //user posted on somebody else's blog, at which point i'd find the user's default blog address and contstruct a wrong URL.

    //define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');

    function get_path($userID){
    global $wpdb;
    $req = "select path from wp_blogs where post_parent='" . $userID . "';";
    //echo $req;
    $res = $wpdb->get_results($req);
    $post['path'] = $res[0]->path;
    return $post;
    }

    function bigcmp($a, $b)
    {
    if ($a['datetime'] == $b['datetime']) {
    return 0;
    }
    return ($a['datetime'] < $b['datetime']) ? 1 : -1;
    }

    $request = "select * from wp_blogs;";
    $result = $wpdb->get_results($request);

    //print_r($result);

    $i = 0;

    foreach($result as $v1){

    //get the blog name from each user and save it as $blogname to use in the next foreach
    $db_table = $db_prefix . "_" . $v1->blog_id . "_options" ;
    $requestx = "select option_value from " . $db_table . " where option_name='blogname' and option_id=2;";
    $resultx = $wpdb->get_results($requestx);
    $blogname = $resultx[0]->option_value;

    //for each user get all their posts
    $db_table = $db_prefix . "_" . $v1->blog_id . "_posts" ;
    $request2 = "select * from " . $db_table . ";";
    $result2 = $wpdb->get_results($request2);
    $domain = $v1->domain;
    $path = $v1->path;

    //print_r($result2);

    //list every post in the system
    foreach($result2 as $v2){

    //this part takes the date and breaks it up into year, month, day, but first save the date to use it
    $array = explode(" ", $v2->post_date);
    $array = explode("-", $array[0]);
    $y = $array[0]; $m = $array[1]; $d = $array[2];

    $allposts[$i]['datetime'] = $v2->post_date;

    $string = $y . "/" . $m . "/" . $d . "/" . $v2->post_name;
    $allposts[$i]['title'] = $v2->post_title;
    $allposts[$i]['path'] = $v1->path;

    $post_type = $v2->post_type;

    /*this part gives you the post/page format, and guid URL if it's a guest poster */
    //if guest user ID?
    if($v2->post_type == attachment) {

    }
    else {
    if($v2->guid !== NULL) {
    $allposts[$i]['fullurl'] = $v2->guid;
    $allposts[$i]['blogname'] = $blogname;
    }

    $i++;}
    }

    }

    usort($allposts, "bigcmp");

    //get total number of posts

    $today = date('m-d-Y');
    $totalposts = count($allposts);
    echo '

      ';
      for($i = 0; $i < $totalposts && $i < $howmany; $i++){
      if ($allposts[$i]['post_type'] == attachment)
      {$howmany++;}
      else {
      $dateposred = explode(" ", $allposts[$i]['datetime']);
      $dateposred = explode(":", $dateposred[1]);
      $dateposted = explode(" ", $allposts[$i]['datetime']);
      $dateposted = explode("-", $dateposted[0]);
      $dateposted = $dateposted[2] . "-" . $dateposted[1] . "-" . $dateposted[0] . " o " . $dateposred[0] . ":" . $dateposred[1] . ":" . $dateposred[2];

      //make the length as short as the implementer wants it
      $url = substr($allposts[$i]['title'], 0, $width);
      $author = "Published " . $dateposted;
      $author = substr($author, 0, $width);
      $blogname = $allposts[$i]['blogname'];
      $blogname = substr($blogname, 0, $width);
      $asd = strlen($allposts[$i]['fullurl']);
      $dsa = strlen("");
      if ($dsa !== $asd) {
      echo '

    • <a href="' . $allposts[$i]['fullurl'];
      echo '" title="';
      echo $author;
      echo '">';
      echo $url;
      echo '';
      echo '
    • ';
      }
      else {$howmany++;}
      }
      }
      echo '
    ';

  3. wep
    Member
    Posted 15 years ago #

    i have pretty permalinks enabled but show ?p=3

About this Topic