Plugin Directory

Changeset 1607026


Ignore:
Timestamp:
03/03/2017 08:09:36 AM (9 years ago)
Author:
burningx
Message:

取消记录自动删除‘自动草稿’日志记录

Location:
mpoperationlogs/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mpoperationlogs/trunk/lib/MpLogs.class.php

    r1569115 r1607026  
    9595
    9696
    97         if(($post && $post->post_type == 'post'))
     97        if(($post && $post->post_type == 'post') && $post->post_status != 'auto-draft')
    9898        {
    9999            $userInfo = wp_cache_get($post->post_author,'users');
    100100            $postTitle = $post->post_title;
    101101            $uid = $userInfo->ID;
    102             $ip = mpoplogs_getUserIp();
    103             $ipObj = new MpIpLogs();
    104             $ips = $ipObj->checkoutUseIp($uid,$ip);
    105             $ipId = 0;
    106             if($ips)
    107                 $ipId = $ips->id;
    108             else
    109                 $ipId = $ipObj ->addUserIp($uid,$ip);
    110             $logs = new self();
    111             $data = array(
    112                 'class' => 'post',
    113                 'op_uid' => $uid,
    114                 'op_data_id' => (int)$postId,
    115                 'data_name' => $postTitle,
    116                 'op_time' => time(),
    117                 'op_ip_id' => $ipId,
    118                 'other_info' => '',
    119                 'op_user_name' => $userInfo->user_login,
    120             );
    121             if(!$isDelete)
     102            if($uid)
    122103            {
    123                 if($post->post_date == $post->post_modified)
    124                     $logs->action('create');
     104                $ip = mpoplogs_getUserIp();
     105                $ipObj = new MpIpLogs();
     106                $ips = $ipObj->checkoutUseIp($uid,$ip);
     107                $ipId = 0;
     108                if($ips)
     109                    $ipId = $ips->id;
    125110                else
    126                     $logs->action('update');
     111                    $ipId = $ipObj ->addUserIp($uid,$ip);
     112                $logs = new self();
     113                $data = array(
     114                    'class' => 'post',
     115                    'op_uid' => $uid,
     116                    'op_data_id' => (int)$postId,
     117                    'data_name' => $postTitle,
     118                    'op_time' => time(),
     119                    'op_ip_id' => $ipId,
     120                    'other_info' => '',
     121                    'op_user_name' => $userInfo->user_login,
     122                );
     123                if(!$isDelete)
     124                {
     125                    if($post->post_date == $post->post_modified)
     126                        $logs->action('create');
     127                    else
     128                        $logs->action('update');
     129                }
     130                else
     131                {
     132                    $logs->action('delete');
     133                }
     134                $logs->data($data)->insert();
    127135            }
    128             else
    129             {
    130                 $logs->action('delete');
    131             }
    132             $logs->data($data)->insert();
     136
    133137        }
    134138    }
  • mpoperationlogs/trunk/mpOperationLogs.php

    r1569223 r1607026  
    44Plugin URI: https://wordpress.org/plugins/mpoperationlogs/
    55Description: 后台管理员操作日志、后台登陆IP记录插件(administrator operation logs and IP record Plugin).
    6 Version: 1.0.0
     6Version: 1.0.1
    77Author: Mrpeng
    88Author URI: http://www.ipy8.com/
  • mpoperationlogs/trunk/readme.txt

    r1569126 r1607026  
    3434= 1.0.0 =
    3535* just getting started
     36
     37= 1.0.1 =
     38* 取消记录自动删除‘自动草稿’日志记录
Note: See TracChangeset for help on using the changeset viewer.