Ask your WordPress questions! Pay money and get answers fast! (more info)

edit this plugin to allow for never ending comment editing WordPress

  • SOLVED

Looking to have the plugin below edited (preferably via a function I can put in my theme's function.php so that the time limit for comment editing is completely removed/never-ending.

At the moment it only allows for editing up to 90 minutes (despite using a longer time) using the function...
// SCE comment edit time
add_filter( 'sce_comment_time', 'edit_sce_comment_time' );
function edit_sce_comment_time( $time_in_minutes ) {
return 514000;
}

https://wordpress.org/plugins/simple-comment-editing/

Please show all changes you made so I can replicate them should the plugin need updating.

Answers (2)

2017-05-17

Reigel Gallarde answers:

I guess you can use it's filter sce_comment_time

add_filter('sce_comment_time','remove_comment_time' );
function remove_comment_time(){
return 0;
}

you can paste this in your functions.php


pjeaje comments:

Yes I've tried that function but in the core it sets the max time to 90 minutes


Reigel Gallarde comments:

if that does not work, (guessing it will not work)
You can edit the file in the plugin simple-comment-editing.php
line 334, where it says $time_left = $comment_time_result[ 'comment_time' ];

just put a value there:
$time_left = 9999;


pjeaje comments:

9999 isn't never-ending


Reigel Gallarde comments:

it is... the time left is always 9999


pjeaje comments:

I've tried the above and the max number I can change it to is 199999, any more than that crashes my website


pjeaje comments:

Sorry i'll test it


Reigel Gallarde comments:

currently, $time_left is dynamic because it get's it's value in the database.. but if you set it to a number greater than 0, it will not change... hence, like never ending.


pjeaje comments:

This stops the plugin from working, no count down timer showing.


pjeaje comments:

and no edit link

2017-05-19

Navjot Singh answers:

Why not just change this code snippet

'if ( $comment_time > 90 ) {
$this->comment_time = 90;
} else {
$this->comment_time = $comment_time;
}'

to

'$this->comment_time = $comment_time;'

And then you should be able to set it to any higher value.


pjeaje comments:

Unfortunately this still keeps the time to edit as 5 minutes, and if I add the function..

`// simple comment edit
add_filter( 'sce_comment_time', 'edit_sce_comment_time' );
function edit_sce_comment_time( $time_in_minutes ) {
return 550000;
}`

... then it crashes the website


pjeaje comments:

It still counts down. I need to have the count down removed or have it countdown by 0 so no time is taken away