WordPress.org

Forums

Audit Trail
[Audit Trail - 1.1.11] Bugs fixed and working now, check it out! (1 post)

  1. biswajeet
    Member
    Posted 1 year ago #

    This is a wonderful plugin and I like it a lot. But there were some bugs due to which it is not working as expected. After the following fix, its working fine now.

    #1. Currect Time option as per wp time setting bugs fixed –
        Log time was displying incorrectly and was not in accordance with WP time setting.
    
    task: 1.1
        File: wp-content/plugins/audit-trail/models/audit.php
        on line: 180; missing arg $gmt=0 in func current_time | change to -> current_time('mysql', $gmt=0)
    
    task: 1.2
        File: wp-content/plugins/audit-trail/view/admin/trail_item.php
        on line: 14; missing get_option('time_format') in func gmdate | change to -> gmdate(get_option('time_format'), $item->happened_at)
    
    #2. Pager issue fixed – 
    
    2.1 - when delete any log, after which pager menu doesnot work
    
    task: 2.1
        File: wp-content/plugins/audit-trail/models/pager.php
    
            Replace these two lines in func AT_Pager():
            $this->url = str_replace ('&', '&', $this->url);
            $this->url = str_replace ('&&', '&', $this->url);
    
            With:
            $this->url = str_replace ('&&', '&', $this->url);
    
    #3. Filter option, view per page fixed;
    Option was provided but no functioning at all. To make this happen, new func is added and also have to modify some func and parameter.
    
    3.1 - New function screen_perpage() to store the filter per page dd value
    
    task: 3.1
        File: wp-content/plugins/audit-trail/ audit-trail.php
            add this func after screen_trail()
    
            function screen_perpage() {
    
                    if( isset($_POST['perpage_filter']) ) {
    
                        update_option ('audit_perpage', $_POST['perpage']);
                        $this->render_message (__ ('Logs view per page option have been updated: '.$_POST['perpage'].' view per page', 'audit-trail'));
                    }
    
                    return $perpage_val = get_option('audit_perpage') ? get_option('audit_perpage') : '';
    
                }
    
    3.2 - add name and id val to filter per page dd list
    
    task: 3.2
        File: wp-content/plugins/audit-trail/view/admin/trial.php
    
        on line 24 replace the old input
        <input type="submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
    
        with
        <input type="submit" value="<?php _e('Filter'); ?>" name="perpage_filter" id="perpage_filter" class="button-secondary" />
    
    3.3 - add a func to get new perpage update value in pager        
    
    task: 3.3
        File: wp-content/plugins/audit-trail/models/pager.php
            add this func before function AT_Pager()
    
        function get_perpage_val() {
               global $obj;
               $perpage_val = $obj->screen_perpage();
               return $this->per_page = !empty( $perpage_val ) ? $perpage_val : $this->per_page;
    
            }
    
    3.4 - Call this func and update offset with new val
    
    task: 3.4
        File: wp-content/plugins/audit-trail/models/pager.php
        Replace the old offset func with this new one
    
        function offset() {
    
        		$this->get_perpage_val();        
    
                $pager_request = isset($_GET['curpage']) ? $_GET['curpage'] : '';
    
                if( !empty($pager_request) && $pager_request > $this->total_pages() ) $offset = ($this->total_pages() - 1) * $this->per_page;
                else $offset = ($this->current_page - 1) * $this->per_page;
    
                return $offset;     
    
        	}
    
    3.5 - Determine the correct current page value when we call the filter per page option
    
    task: 3.5
        File: wp-content/plugins/audit-trail/models/pager.php
        Replace the old current_page() this new one
    
        function current_page() { 
    
               return $this->current_page = $this->current_page > $this->total_pages() ? $this->total_pages() : $this->current_page; 
    
            }
    
    3.6 - Also remove the filter option - 10 per page view which doesn't work correctly when pager is 100+ pages.
          Filter Option 25 - 250 per page view is just fine 
    
    task: 3.6
        File: wp-content/plugins/audit-trail/models/pager.php
        @ func AT_Pager line: 114
    
        Replace
        $this->steps = array (10, 25, 50, 100, 250);
    
        With
        $this->steps = array (25, 50, 100, 250);

    Hope this will help this plugin uers as well as the author to fix these issues in the upcoming version. Suggestions and comments are welcome to make it better bug free!

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic