general related post

How to get the Expresion Engine CP to log new entries, the editing of entries and deletion of entries.

categories:ExpressionEngine
tags:

In this tut you will be modifying your EE Api_channel_entries.php file so remember to make a backup. A complete modified Api_channel_entries.php file for this tut can be downloaded here.

By default the expression engine control panel logs certain actions like Channel creation, Channel deletion and the Logging in and Logging out of users to the control panel. The problem is that it does not by default log any entry actions like creating new entries, editing an entry or deleting entries. This is quite surprising to me as it is important to track these kind of actions. Then at least you will know who to blame for deleting that all important page.
Please note that this tutorial is for Expression Engine 2 and has only been tested on Version 2.2.0.

I then found this post on logging your own actions into the control panel log table of the database.
http://erikreagan.com/blog/logging-actions-in-your-expressionengine-add-ons/

This data is accessable via the Tools option in the admin menu.
Tools > Logs > View Control Panel Log

This gave me the idea to simply add my own logging action so that the system could record entry changes made.
Originally i thought that you could simply enable hooks in the config file then somehow hook an action into a script to log your new action. As i needed a resolution fast and could not find more assitance on this matter i decided to go about it my own way.

I tracked down the channel Entries API file which you can find here: system/expression/libraries/api/Api_channel_entries.php
Then using the EE2 code from the erikreagan.com blog post, i pasted the code with my own log message into certain parts of the Api_channel_entries.php file.

Firstly to track new entries i put the code into the _insert_entry function. Then to track editing i pasted the code into the _update_entry function and finally to track deletions i pasted the code into the delete_entry function.

Now if you create, edit or delete an entry your action will be recorded into the cp_log table of the database.

Hope this helps, Nathaniel.


Leave a Reply

Please note that if your comment is in no way related to the contents of this post it will not be published.

D2C Services

HTML, CSS, JQUERY, PHP, Wordpress, Codeigniter, Expression Engine.

What ever your CMS or need D2C can develop it for you

PSD to HTML, PSD to Worpdress theme, PSD to Expression Engine.

You Design we Code, let us give life to your PSD

Custom Online Application Development.

Contact us to build your custom CMS, Project management system or Intranet.

Contact D2C

Call D2C on +27 72 333 0239 or fill out the below form

loading