XPressME Integration Kit

Trac

Changeset 597


Ignore:
Timestamp:
Apr 30, 2010, 9:37:22 PM (15 years ago)
Author:
toemon
Message:

D3Forumの不可視状態と、 WP3で導入された「ゴミ箱」の連携 Fixes#338

Location:
trunk/xpressme_integration_kit/wp-content/plugins/xpressme
Files:
2 edited

Legend:

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

    r595 r597  
    8686} 
    8787 
     88function onaction_trashed_post_comments($post_id){ 
     89        global $wpdb; 
     90        set_d3f_topic_invisible($post_id,1); 
     91} 
     92function onaction_untrashed_post_comments($post_id){ 
     93        global $wpdb; 
     94        set_d3f_topic_invisible($post_id,0); 
     95} 
     96function onaction_trashed_comment($comment_ID  = ""){ 
     97        global $wpdb; 
     98        $comment_type = $wpdb->get_var("SELECT comment_type FROM $wpdb->comments WHERE comment_ID = $comment_ID"); 
     99        if (!empty($comment_type)) return ;      
     100        set_d3f_post_invisible($comment_ID,1); 
     101} 
     102function onaction_untrashed_comment($comment_ID  = ""){ 
     103        global $wpdb; 
     104        $comment_type = $wpdb->get_var("SELECT comment_type FROM $wpdb->comments WHERE comment_ID = $comment_ID"); 
     105        if (!empty($comment_type)) return ;      
     106        set_d3f_post_invisible($comment_ID,0); 
     107} 
     108 
     109function set_d3f_topic_invisible($topic_external_link_id,$invisible){ 
     110        global $wpdb,$xoops_db,$blog_id,$xpress_config; 
     111         
     112        if (empty($blog_id)) $blog_id =1; 
     113        $d3forum_prefix = get_xoops_prefix() . $xpress_config->d3forum_module_dir . '_'; 
     114        $d3f_topic = $d3forum_prefix . 'topics'; 
     115        $d3f_forum_id = $xpress_config->d3forum_forum_id; 
     116        //xdb_d3forum_posts  where topic_external_link_id = topic_external_link_id update topic_invisible 
     117         
     118        $sql  = "UPDATE $d3f_topic "; 
     119        $sql .= "SET topic_invisible = $invisible "; 
     120        $sql .= "WHERE topic_external_link_id = $topic_external_link_id AND forum_id = $d3f_forum_id" ; 
     121        $xoops_db->query($sql); 
     122} 
     123 
     124function set_d3f_post_invisible($wp_comment_ID, $invisible){ 
     125        global $wpdb,$xoops_db,$blog_id,$xpress_config; 
     126         
     127        if (empty($blog_id)) $blog_id =1; 
     128        $d3forum_prefix = get_xoops_prefix() . $xpress_config->d3forum_module_dir . '_'; 
     129        $d3f_posts = $d3forum_prefix . 'posts'; // delete key topic_id 
     130 
     131        $d3f_post_id = get_d3forum_post_ID($wp_comment_ID); 
     132        //xdb_d3forum_posts  where post_id update invisible 
     133        if ($d3f_post_id){ 
     134                $sql  = "UPDATE  $d3f_posts SET invisible = $invisible WHERE post_id =$d3f_post_id"; 
     135                $xoops_db->query($sql); 
     136        } 
     137} 
     138 
    88139function disp_d3forum_comments($template_dir="", $file_name="") 
    89140{ 
     
    92143        return $file_path; 
    93144} 
    94  
    95145 
    96146function d3f_module_found($forum_dir ='d3forum'){               //use admin/admin_enhanced.php 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php

    r596 r597  
    128128        add_action("wp_set_comment_status" , "onaction_comment_apobe"); 
    129129        add_action("publish_post",      "onaction_comment_close"); 
    130  
    131          
     130         
     131        // comment trashed untrashed action 
     132        add_action("trashed_post_comments",     "onaction_trashed_post_comments"); 
     133        add_action("untrashed_post_comments",   "onaction_untrashed_post_comments"); 
     134        add_action("trashed_comment",   "onaction_trashed_comment"); 
     135        add_action("untrashed_comment", "onaction_untrashed_comment"); 
     136 
    132137        add_filter('comments_template', "disp_d3forum_comments" ); 
    133  
    134 } 
    135  
    136  
     138} 
    137139 
    138140//The trackback and the pingback are excluded from the count of the comment.  
Note: See TracChangeset for help on using the changeset viewer.