Skip to content

Commit 469e9ac

Browse files
committed
fixed: disable system_log from tracking view count modifications
1 parent 7b50ba4 commit 469e9ac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

views/default/entity_view_counter/extends/counter.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
$session_id = $session->getId();
4242

4343
// log the user who is viewing
44-
// if no logged in user, log by entity
44+
// if no logged-in user, log by entity
4545
$owner_guid = elgg_get_logged_in_user_guid() ?: $entity->guid;
4646

47-
$annotation_id = $entity->annotate(ENTITY_VIEW_COUNTER_ANNOTATION_NAME, $session_id, ACCESS_PUBLIC, $owner_guid);
47+
$annotation_id = elgg_call(ELGG_DISABLE_SYSTEM_LOG, function() use ($entity, $session_id, $owner_guid) {
48+
return $entity->annotate(ENTITY_VIEW_COUNTER_ANNOTATION_NAME, $session_id, ACCESS_PUBLIC, $owner_guid);
49+
});
4850
if (!$annotation_id) {
4951
// someone prevented the creation of the annotation
5052
return;
@@ -62,6 +64,6 @@
6264
$current_count++;
6365
}
6466

65-
elgg_call(ELGG_IGNORE_ACCESS, function () use ($entity, $current_count) {
67+
elgg_call(ELGG_IGNORE_ACCESS | ELGG_DISABLE_SYSTEM_LOG, function () use ($entity, $current_count) {
6668
$entity->entity_view_count = $current_count;
6769
});

0 commit comments

Comments
 (0)