Audit Trail Plugin

download

Download: Audit Trail
Other: WordPress.org | SVN
Support: Forum

Audit Trail is a plugin to keep track of what is going on inside your blog. It does this by recording certain actions (such as who logged in and when) and storing this information in the form of a log. Not only that but it records the full contents of posts (and pages) and allows you to restore a post to a previous version at any time.

To summarize:

  • Log of user actions inside your blog – useful for finding out who did what in a multi-user system
  • Extensible, allowing other plugins the ability to add and display items in the Audit Trail
  • Ability to track registered user page visits
  • Fully localized

Installation

The plugin is simple to install:

  1. Download Audit Trail
  2. Unzip
  3. Upload audit-trail directory to your /wp-content/plugins directory
  4. Go to the plugin management page and enable the plugin

You can find full details of installing a plugin on the plugin installation page.

NOTE: If you are upgrading from a pre 1.0 version please de-activate and then re-activate the plugin. This will upgrade your database tables (unfortunately any existing Audit Trail data will be lost).

Audit Trail is available in the following languages (included in the plugin):

If you are multi-lingual then I always appreciate any translations that you can provide.

Usage

Once the plugin is installed then your actions are already being recorded. You can view the Audit Trail log from the Manage/Audit Trail page.

Log

Note that some entries in the log can be clicked and will expand to show more details.

Options

From the options page you can configure exactly what actions are audited. Any plugins that support Audit Trail will also display themselves here.

Permissions

Users with the ‘edit_plugins‘ or ‘audit_trail‘ capability can view and administer the Audit Trail plugin. The ‘audit_trail‘ capability can be added with the Role Manager plugin.

Support & Bugs

Support and feature requests should be made through the Audit Trail support forum. You can contact me directly but I spend a very limited amount of time on direct support and you stand a better chance of being answered through the forum.

If you find the plugin useful then please do consider making a donation – it is appreciated and helps towards the maintenance of the plugin.

Thanks!

202 comments

  1. I’m trying to show the version history dropdown on each post (on the blog, not in the admin interface) for logged in users with the right capabilities. Any clues on how this could be done?

  2. Plugin is great!

    I was having problems with the ignore functionality. I’m no php expert, but I did this:

    Line 78 of auditor.php from:
    explode (‘,’, ‘ignore’);

    to:

    explode (‘,’, $ignore);

  3. Hey,

    the solution in post 90 is exactly this what works! I have tried and tried many hours to hide users from the audit trail list, but nothing… and now this simple trick.

    Cause I think this is an error in the script: Please corecct it in the downloadable version on this page.

    And by the way: Its a great plugin, thanx!

    Farbmond

  4. Pingback: FavFam.com » Help
  5. This doesn’t seem to have been updated for WP 2.7. I’d love to use it–especially for the “track changes”-type function of displaying differences between two versions of a post.

  6. Hi Guys
    It is my first time dealig with Oracle databse and i’m experiencing the below problem any ideas what might be causing this problem?

    Your input is highly valued.

    Critical alarmAlarm number: 97468Time: 2009-01-15 12:43:53.967Event type: 801Object class of reference: 21Object of reference:
    Server1@NAIROBIMM1Specific problem: 801Probable cause: 801Proposed repair action: 801Record type: 1Additional information: There is
    a problem with the system environment (memory, disk, etc).
    Failed to recover overflow file /var/opt/BGw/Server1/CAA9011333_R1F_7/storage4/logging/AU_Q2_0000000008.
    Could not execute an Oracle insert statement on table auditTrailLogEntry.
    ORA-00001: unique constraint (SERVER4.IND1_AUDITTRAILLOGENTRY) violated.

  7. John, I read your post about baselining all of your plugins to 2.7 but audit trail still says “2.0+” – does that mean it’s not yet been baselined and is therefore not compatible with 2.7?

  8. Hi John,

    Great Plugin! I’ve been searching for a user generated stat tool that creates a csv report and you made it happen!

    I did notice a bug in the csv reporting. I couldn’t use the issue tracker to report the bug so I post it here.

    When you export the data it generates the following values:

    Date Time User Operation Item IP
    26/03/2009 9:47 View page /blog/ 24.202.38.175
    26/03/2009 9:47 View page /blog/feed/ 24.202.38.175
    26/03/2009 9:47 View page /blog/feed/atom/ 24.202.38.175
    26/03/2009 9:47 View page /blog/live-event-registration/ 24.202.38.175
    26/03/2009 9:47 View page /blog/feed/atom/ 24.202.38.175
    26/03/2009 9:47 View page /blog/feed/ 24.202.38.175

    You can see the problem, the ‘User’ value should be the name of the user and not the Operation.

    I found where you made the modification for the csv generation ‘csv.php’ and I found where you created the functions get_items() and get_operations() in ‘audit.php’, can you provide me with the code equivalent to get_username() that I can enter in audit.php and call in csv.php. I need to output the username in the csv file.

    Thanks in advance
    Patrick S.

  9. I am running wordpress on IIS 7. When I try to access the options for this pluggin I get a page not found. Any sugestions?

  10. Hi John,

    Great Plugin! I’ve been using it for quite some time now. I know there is an auto expire after a certain period of time.
    Still…. Is there a way i can select random actions from the results page and delete them?
    I can see at the top saying mass actions => delete (as found in the posts or comments) but cannot figure out how to randomly select them.
    I was hoping for something like this in this updated version.
    Thanx in advance

  11. Great plugin, very powerful

    but all the filtering, apart from lines per page, is on the input/data collection side, so I am confronted with viewing about 29,000 records for 30 days of audit trail, (I have not been collecting post/page and link data so far) So the data is a bit like looking into a forest. Despite your updates of version 1.0.8 the records show me an audit trail time of that of my hosting provider (GoDaddy – Scottsdale, AZ) rather than the real times I’m used to of UTC or UTC+1(when DST as at present) i.e. UK time, as set in the WP 2.8.2 general settings

    I’d like some filtering on the view side, something of the nature of dragging an item (user, action, target or IP) to one of three areas, longterm_filter, session_filter and shortterm_filter.

    I may not be interested in looking at the page view records relating to say googlebot so I would drag googles IP to the longterm area, so its records would remain filtered out until I reset all filters or specifically disable the filter

    I may not be interested in my own (or someone elses) records so I would drag an IP or user to the session filter where it would remain until I logout or remove it from the filters, and when I log back in the filter has been cleared.

    I may not be interested in some records so I would drag an item to the short term filter where its filtering out would remain active until I refresh the data listing apart from moving from page to page of the say 100 record blocks.

    I hope this scheme makes sense or is workable, my knowledge of php is a bit too limited or I would probably have worked it out and forwarded the code for inclusion into the plugin

  12. Have used your plugin for 18 months now and am thoroughly satisfied – to the extent that the new ” Paypal” logo on the top inspired me to make a small donation!!

    A couple of issues, the big one is not being able to exclude a particular user (me!) from the listings which I see is on your bug list, while the second is the excel download of data where the data does not tie in with the advertised header.

    Anyway, many thanks … Keith

  13. Great plugin! I use it to track number of hits to my blog by username; unfortunately, there’s one small bug (already mentioned by another user) that makes this usage problematic. Instead of listing the username under “User” in the CSV file, Audit Trail lists the action. This makes it impossible to sort by user in Excel and thereby extrapolate the data. Will happily make a further donation to PayPal if this issue is remedied. Thanks much!

  14. Looks like a great plugin. However after activating I’m getting the error: “Fatal error: Call to undefined function number_format_i18n() in /plugins/audit-trail/models/pager.php on line 473”

    Any idea how to fix?

      1. Just upgraded. Great for having the delete function back.

        BUT… it produces errors

        Warning: Invalid argument supplied for foreach() in …/plugins/audit-trail/audit-trail.php on line 121

        Warning: Cannot modify header information – headers already sent by (output started at /…/plugins/audit-trail/audit-trail.php:121) in …/plugins/sidebar-login/sidebar-login.php on line 314

    1. I have the same problem using WP3.0 I cant delete the checked items in my log. In addition the options screen won’t save the name of an ignored user.

        1. i find it.
          WP3.0 default theme change trail.php on line 10 11

          <form method="post" action="url ($pager->url) ?>”>
          render_admin (‘pager’, array (‘pager’ => $pager)); ?>

          change 11 10
          render_admin (‘pager’, array (‘pager’ => $pager)); ?>
          <form method="post" action="url ($pager->url) ?>”>
          will fine

      1. After installing and activating sitewide in MU 2.9.2, and setting options to track everything, there are no results to display.

        Must something different be done for MU?

  15. It’s worth noting that you have to select the list of activities to record in the logs from the ‘options’ menu after installation, otherwise it will not be keeping a trail of anything.

    Thanks for your contribution with this plugin.

  16. Great plugin. I was wondering though is there a way to make it display the users name as well as the login name, or instead of. the only reason I ask is because I use the facebook connect and for that to work it automatically uses the facebook user ID as the login name. This gets confusing when I am looking at the records.

  17. There is a bug probably in Audit Trail Plugin for time zone offset. If you set the time zone in WP using UTC offset rather than country/city name then wrong time is shown in the log. I found this error using WP-301 & AT-1.1.7 Please verify it.

    btw, wonderful extension!
    thanks 🙂

  18. This plugin does exactly what I wanted and was simple to set up and
    use. I have the same problem as the previous writer regarding the
    time; it does not show up correctly (the date is good), both with
    UTC or with City setting. Minor annoyance with an otherwise really
    nice little plugin! Lin

  19. I’m would like to only log event from logged in users and ignore public actions. I tried to add 0 to the ignore list of users, but it still logs public view. Is there a way for it to only track logged in user data?

    Thanks,

    Shane

  20. What a FANTASTIC plugin!

    It is exceptionally stylish in its presentation and functionality so Many thanks for providing exactly what I was looking for.

    I am using it to log visits to my Tips page to prevent possible issues with members about viewing the premium information.

    @raz and @Lin both mentioned the time issue some months back and as you have updated the plugin since it is a shame the issue was overlooked.

    Until then…

    The Solution is as follows:

    line 180 of audit-trail\models\audit.php reads:

    $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->prefix}audit_trail (user_id,ip,operation,item_id,happened_at,data,title) VALUES(%d,%s,%s,%s,NOW(),%s,%s)", $user, $ip, $operation, $item, $data, $title ) );

    You need to replace the MYSQL function NOW() which uses the server time to:

    current_time(‘mysql’) which is the WordPress function to fetch the date/time according to the Timezone on the General Settings page.

    The line will now read:

    $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->prefix}audit_trail (user_id,ip,operation,item_id,happened_at,data,title) VALUES(%d,%s,%s,%s,%s,%s,%s)", $user, $ip, $operation, $item, current_time('mysql'), $data, $title ) );

    I hope this helps your readers!

    Keep up the excellent work.

    Simon

  21. Thanks for this great plugin!

    I’d like to add and display additional items in the Audit Trail.

    Can you direct me to instructions on how to do this?

    Specifically, I would like to log the changes the users make to their Display Name.

  22. Hello John,
    What a wonderful plugin. 🙂
    I wonder though. Does it work in a multisite environment?
    And if so, should it be network activated or site-by-site? Does it create any additional tables on the dB? If so is there an extra table for each site it gets activated or just one global table? Does it leave any data or tables after de-installation or de-activation?
    Thank you in advance.

  23. Looking for a way of monitoring visitors logging in and using the site, this looks exactly what I want, and I shall certainly make a donation if I can iron out the couple of wrinkles I have, and then use it. I am testing it on WP 3.3.1

    1) I see that other have had problems in the past in not being able to delete records. I am having the same problem – I tick the checkboxes for records to be deleted, go to ‘Bulk Actions’ where the only option in the list is ‘delete’, but when I click ‘Apply’, nothing happens.
    2) I see references to print files in some of the other posts, but cannot see how to do so, or to activate a print option or function.

    Can you help on these, please?

    Many thanks

  24. Why does the audit trail show Urban Giraffe viewing my site from different IP Addresses? I turned off “Audit Trail Actions”, but there are still some on there.

  25. Can it track changes to things like Theme settings, widgets etc. i.e. aside from posts/pages, I’m looking for something to track those kinds of changes. If Audit Trail doesn’t do that, do you know anything that does?

  26. Hello. I love this plugin and have made a donation.
    When I try to download to CSV, the file is zero bytes. Totally empty.
    The plugin is tracking several activities, boxes checked, plenty of data.
    If, before clicking the Excel icon, I select every line, still, CSV is empty.
    What might I be doing wrong?
    Thank you in advance.

  27. Hi, This looks great. Question for you: Can it track changes to template files? Our client wants to use a 3rd party SEO consultant, but we wish to track what they do and when, so we can be sure who is accountable if something goes wrong.

  28. Hi John, thanks for publishing this plugin, it’s definitely needed.

    I’ve found several bugs in the current release, though, and pointed out how to fix them on the forums:

    http://wordpress.org/support/topic/php-warning-in-modelspagerphp-line-106
    http://wordpress.org/support/topic/error-in-mysql-limit-clause
    http://wordpress.org/support/topic/multisite-network-activation-fails

    If you don’t have time to integrate those fixes into the official release, I’d be happy to help out with that. Just e-mail me and we can work out the details.

  29. Does the audit trail work with Gravity Forms?

    I’d love the ability to be able to see a full log of all the changes made to forms including the ability to return to a revision that was taken.

    David

  30. I was wondering how to configure Audit Trail so that it works with fail2ban?
    Is there configurations that need to be done within the fail2ban config as well?
    Any newbie help would really be appreciated

Leave a Reply to Manne Cancel reply

Your email address will not be published. Required fields are marked *