Hi. Yes, I should document that hook…
It’s actually the WordPress file_mod_allowed filter that ultimately controls whether DISALLOW_FILE_MODS
is observed.
This plugin’s loco_file_mod_allowed_context
filter changes the context that gets passed to WordPress’s wp_is_file_mod_allowed function. By default the value is "download_language_pack"
but depending on your needs you might want to change that.
So, putting them both together you can achieve your goal with something like this:
/* define a context value to allow translation file mods */
add_filter('loco_file_mod_allowed_context', function(){
return 'my_file_mod_context';
} );
/* let our file context override the default */
add_filter('file_mod_allowed', function($default,$context){
if( 'my_file_mod_context' === $context ){
return current_user_can('loco_admin');
}
return $default;
},10,2);
Note that this will operate on ALL file modifications initiated by Loco Translate, not just MO file compilation as per your original question.
Please note that general coding help is beyond the remit of my support, so I suggest you familiarize yourself with WordsPress filters in general, and where to place them so they run when you need them.