Sign in to follow this  

Compare edited content

Recommended Posts

Im having a bit of trouble trying to compare the content of two edited posts.

Using the values provided: 

  • content - The created/updated content
  • changed - An array of the properties being saved
  • new - Boolean value indicating if content is new

I get the following response from $content

stdClass Object
    [warning] => 
    [rulesDataChanged] => 
    [changed] => Array

    [skipCloneDuplication] => 
    [reactBlurb] => 
    [likeBlurb] => 

Theres no values?

I was hoping to find somewhere the previous post content so that I could compare how different the change was when the content was updated.

When I use $changed I am able to grab the post data from $changed->post but thats only the new value, anyone suggest how to find the old value?

Share this post

Link to post
Share on other sites

For anyone interested in something similar, I ended up just using the database table core_edit_history by doing the following:

$edited = \IPS\Db::i()->select( '*', 'core_edit_history', array( array( 'comment_id=?', $content->pid ), array( 'time=?', $content->edit_time ) ) )->first();
$comparison = similar_text($edited['old'], $edited['new'], $perc);

return $perc;


  • Like 1

Share this post

Link to post
Share on other sites

Your content will need to be approved by a moderator

You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this