diff --git a/src/classes/repositories/class-tainacan-logs.php b/src/classes/repositories/class-tainacan-logs.php index 55f3bc6af..075e0f973 100644 --- a/src/classes/repositories/class-tainacan-logs.php +++ b/src/classes/repositories/class-tainacan-logs.php @@ -260,6 +260,10 @@ class Logs extends Repository { $collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default'; + if ( method_exists($entity, 'get_repository') && !$entity->get_repository()->use_logs ) { + return; + } + if ( $entity instanceof Entities\Collection ) { $collection_id = $entity->get_id(); $log->set_title( sprintf( __( 'New file was attached to Collection "%s"', 'tainacan'), $entity->get_name() ) ); @@ -272,15 +276,11 @@ class Logs extends Repository { $object_type = get_class($entity); $object_id = $entity->get_id(); - $diff = []; - $log->set_collection_id($collection_id); $log->set_object_type($object_type); $log->set_object_id($object_id); $log->set_action('new-attachment'); - $title = __( sprintf('') , 'tainacan'); - $prepared = [ 'id' => $attachment->ID, 'title' => $attachment->post_title, @@ -313,7 +313,9 @@ class Logs extends Repository { $entity = Repository::get_entity_by_post( $entity_post ); if ( $entity ) { - + if ( method_exists($entity, 'get_repository') && !$entity->get_repository()->use_logs ) { + return; + } $collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default'; $log = new Entities\Log();