Sorry @radu81 , the code is right but you need to do more than just that. Please undo all the earlier suggested modifications.
Part #1 - Adding Board Permission
Now, find in two occurences of this in ManagePermissions.subs.php
'modify_own',
Add after both:
'modify_anytime',
Then find:
'modify' => array(true, 'post'),
Add after:
'modify_anytime' => array(false, 'post'),
Now, open ManagePermissions.english.php and find:
$txt['permissionname_modify_any'] = 'Any post';
Add after:
$txt['permissionname_modify_anytime'] = 'Modify posts at anytime';
$txt['permissionhelp_modify_anytime'] = 'Modify posts at anytime';
That all will cover permission addon manually.
Part #2 - Add it to message permission (from earlier code)
Same as before, open Messages.subs.php and find:
$message['approved'] && !empty($modSettings['edit_disable_time']) && $message['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
Add before
!allowedTo('modify_anytime') &&
Part #3 - Add it to post permission
There is two occurences of this code, one for modify and the other for quick edit:
!empty($modSettings['edit_disable_time'])
Add before:
!allowedTo('modify_anytime') &&
Part #4 - Displaying Modify Button
Find in Display.controller.php (to display modify / quick edit button):
'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || (allowedTo('modify_replies') && $context['user']['started']) || (allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) ||
Add after:
allowedTo('modify_anytime') ||
I have tested the code and it is working. You can do it manually, or package this up or you can create a hook based it.
If there is any error or it is not working as expected, do report.