XPressME Integration Kit

Trac

Changeset 157


Ignore:
Timestamp:
Apr 6, 2009, 12:33:22 AM (15 years ago)
Author:
toemon
Message:

#90 マルチループを使っているブロックがマルチユーザに対応していない に対する修正

Location:
trunk/wp-content
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r155 r157  
    77                $user_info = get_userdata($uid); 
    88                $output = $user_info->display_name; 
     9        } 
     10        if (empty($show)) 
     11                return $output; 
     12        else 
     13                echo $output; 
     14                 
     15} 
     16function xpress_selected_author_id($show=true ) { 
     17        $output = ''; 
     18        $author_cookie = get_xpress_dir_name() . "_select_author" ; 
     19        if (!empty($_COOKIE[$author_cookie])){ 
     20                $output = intval($_COOKIE[$author_cookie]); 
     21        } else { 
     22                $output = ''; 
    923        } 
    1024        if (empty($show)) 
  • trunk/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php

    r142 r157  
    2323        $block = array(); 
    2424        $item_no = 0;    
     25         
     26        $selected_author_id = xpress_selected_author_id(false);  
    2527 
    2628        global $wpdb,$wp_query; 
     
    5153                 
    5254                $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                } 
    5358 
    5459                if ($cat_select) { 
     
    7378                        $where .= " AND ($post2cat_tb.category_id IN ($cat_id))"; 
    7479                } 
     80                if (!empty($selected_author_id)){ 
     81                        $where  .= " AND $post_tb.post_author = $selected_author_id "; 
     82                } 
     83 
    7584        } 
    7685        if ($show_month_range > 0) { 
  • trunk/wp-content/themes/xpress_default/blocks/recent_posts_content_block_theme.php

    r145 r157  
    2020        if(empty($tag_select)) $tag_where = ''; else $tag_where = "tag='$tag_select'&"; 
    2121         
     22        $selected_author_id = xpress_selected_author_id(false);  
     23        if (!empty($selected_author_id)){ 
     24                $author_where ="author=$selected_author_id&"; 
     25        } else { 
     26                $author_where = ''; 
     27        } 
    2228        global $wpdb,$wp_query; 
    2329        $block = array(); 
     
    2632                $wp_query->in_the_loop = true;          //for use the_tags() in multi lopp  
    2733                if (array_search(0,$selected)===0) { 
    28                         $r = new WP_Query($tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
     34                        $r = new WP_Query($author_where . $tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    2935 
    3036                } else { 
    3137                        $cat_id = implode(',',$selected); 
    32                         $r = new WP_Query($tag_where . "cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
     38                        $r = new WP_Query($author_where . $tag_where . "cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    3339                } 
    3440                while($r->have_posts()){                         
  • trunk/wp-content/themes/xpress_default/blocks/recent_posts_list_block_theme.php

    r142 r157  
    1717        if (empty($time_format)) $time_format = get_settings('time_format'); 
    1818        if(empty($tag_select)) $tag_where = ''; else $tag_where = "tag='$tag_select'&"; 
     19 
     20        $selected_author_id = xpress_selected_author_id(false);  
     21        if (!empty($selected_author_id)){ 
     22                $author_where ="author=$selected_author_id&"; 
     23        } else { 
     24                $author_where = ''; 
     25        } 
    1926         
    2027        global $wpdb,$wp_query; 
     
    2431                $wp_query->in_the_loop = true;          //for use the_tags() in multi lopp  
    2532                if (array_search(0,$selected)===0) { 
    26                         $r = new WP_Query($tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
     33                        $r = new WP_Query($author_where . $tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    2734 
    2835                } else { 
    2936                        $cat_id = implode(',',$selected); 
    30                         $r = new WP_Query($tag_where . "cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
     37                        $r = new WP_Query($author_where . $tag_where . "cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish"); 
    3138                } 
    3239                while($r->have_posts()){                         
Note: See TracChangeset for help on using the changeset viewer.