WordPress.org

Ready to get started?Download WordPress

Forums

Audit Trail
Page forward only moves one record (3 posts)

  1. cori.criss
    Member
    Posted 1 year ago #

    Selecting to move a page forward only moves one record...there are manual fixes for this but would be great if the plug-in was fixed and updated.

    We support you but only use this on two very small company websites, so we're not a big user...anyway if you could fix would be helpful.

    Love the plug-in otherwise, great for tracking what pages a client views and obviously following up on potential sales - thanks for making it available!

    http://wordpress.org/extend/plugins/audit-trail/

  2. spiderguy252
    Member
    Posted 1 year ago #

    Yeah, ditto. I didn't even realize, initially. And does anyone know how you can ignore anonymous users, and just keep a track on registered ones?

  3. chuckfloyd
    Member
    Posted 7 months ago #

    I've posted this in another support thread and have copied it here:

    Hello,

    Please modify the audit-trails/models/pager.php file in the function prepare_items() around line 110:

    $rows = $wpdb->get_results( $wpdb->prepare("SELECT {$wpdb->prefix}audit_trail.*,{$wpdb->users}.user_nicename AS username FROM {$wpdb->prefix}audit_trail LEFT JOIN {$wpdb->users} ON {$wpdb->users}.ID={$wpdb->prefix}audit_trail.user_id ORDER BY ".$orderby.' '.$order." LIMIT %d,%d", (($this->get_pagenum() - 1) * $per_page), $per_page));

    The issues is the the use of the MySQL LIMIT where as the first parameter is the page number and the second is how many to display per page. The starting parameter should be the row count to start with so we need to determine that number. In my case, I just decided to subtract 1 from the current page and use that as my starting row. After that, beginning with page 2, I want to show rows starting at 25, for 25 count. For page 3, it would be row 50 for 25.

    Page 1 = ... LIMIT 0,25
    Page 2 = ... LIMIT 25,25
    Page 3 = ... LIMIT 50,25
    Page 4 = ... LIMIT 75,25
    Page 5 = ... LIMIT 100,25
    ...

    This resolves the pagination issue.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic