XPressME Integration Kit

Trac


Ignore:
Timestamp:
Apr 6, 2009, 6:29:42 PM (16 years ago)
Author:
toemon
Message:

#91 マルチユーザモードでユーザ指定時人気記事リストブロックが表示されないバグ修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php

    r157 r158  
    2626        $selected_author_id = xpress_selected_author_id(false);  
    2727 
    28         global $wpdb,$wp_query; 
     28        global $wpdb,$wp_query,$xoops_db; 
    2929         
    3030        $db_prefix = get_wp_prefix(); 
     
    4343        include ($mydirpath . '/wp-includes/version.php'); 
    4444                 
    45         $select = "SELECT $view_tb.post_views, $post_tb.ID, $post_tb.post_title, $post_tb.post_date, $user_tb.display_name";                             
    46         if ($wp_db_version >= 6124){ 
    47                 $from  = " FROM (((("; 
     45        $select = "SELECT $view_tb.post_views, $post_tb.ID, $post_tb.post_title, $post_tb.post_date";                            
     46 
     47                $from  = " FROM ((("; 
    4848                $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 
    4949                $from .= " INNER JOIN $term_relationships_tb ON $post_tb.ID = $term_relationships_tb.object_id)"; 
    5050                $from .= " INNER JOIN $term_taxonomy ON $term_relationships_tb.term_taxonomy_id = $term_taxonomy.term_taxonomy_id)"; 
    51                 $from .= " INNER JOIN $terms_tb ON $term_taxonomy.term_id = $terms_tb.term_id)"; 
    52                 $from .= " INNER JOIN $user_tb ON $post_tb.post_author = $user_tb.ID"; 
     51                $from .= " INNER JOIN $terms_tb ON $term_taxonomy.term_id = $terms_tb.term_id "; 
    5352                 
    54                 $where = " WHERE ($post_tb.post_type = 'post') AND ($post_tb.post_status = 'publish')"; 
    55                 if (!empty($selected_author_id)){ 
    56                         $where  .= " AND $post_tb.post_author = $selected_author_id "; 
    57                 } 
     53                $where = " WHERE $post_tb.post_type = 'post' AND $post_tb.post_status = 'publish'"; 
     54//              if (!empty($selected_author_id)){ 
     55//                      $where  .= " AND ($post_tb.post_author = $selected_author_id) "; 
     56//                      $where  .= " AND ($post_tb.post_author = 2) "; 
     57//              } 
    5858 
    5959                if ($cat_select) { 
     
    6767                } 
    6868                 
    69         } else { 
    70                 $from  = " FROM (("; 
    71                 $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 
    72                 $from .= " LEFT JOIN $post2cat_tb ON $post_tb.ID = $post2cat_tb.post_id)"; 
    73                 $from .= " INNER JOIN $user_tb ON $post_tb.post_author = $user_tb.ID"; 
    74                  
    75                 $where = " WHERE ($post_tb.post_status = 'publish') AND  (UNIX_TIMESTAMP($post_tb.post_date) <= UNIX_TIMESTAMP())" ; 
    76                  
    77                 if ($cat_select) { 
    78                         $where .= " AND ($post2cat_tb.category_id IN ($cat_id))"; 
    79                 } 
    80                 if (!empty($selected_author_id)){ 
    81                         $where  .= " AND $post_tb.post_author = $selected_author_id "; 
    82                 } 
    83  
    84         } 
     69 
    8570        if ($show_month_range > 0) { 
    8671                        $where .= " AND (UNIX_TIMESTAMP($post_tb.post_date) >= UNIX_TIMESTAMP(DATE_ADD(CURRENT_DATE, INTERVAL -$show_month_range month)))"; 
    8772        } 
    8873        $order_limmit = " GROUP BY $post_tb.ID ORDER BY $view_tb.post_views DESC LIMIT 0, $disp_count"; 
    89          
    90         $populars = $wpdb->get_results($select . $from . $where . $order_limmit); 
     74        $sql = $select . $from . $where . $order_limmit; 
     75 
     76        $populars = $wpdb->get_results($sql); 
    9177         
    9278        foreach ($populars as $popular){ 
     
    156142                        $post_modified_date_time = $post_modified_date . ' ' . $post_modified_time ; 
    157143                        $trackback_url = trackback_url(false); 
    158                         $post_viwes = xpress_post_views_count($post_id,'views: %d' ,false); 
     144                        $post_viwes = xpress_post_views_count($post_id,__('views: %d','xpress') ,false); 
    159145//                      if (empty($tags)) $tags = __('Not Tag'); 
    160146 
Note: See TracChangeset for help on using the changeset viewer.