💬 General ✓ Solved

Vtiger CRM History widget always shows 'admin' — ModTracker bug fix

👤 tomaszewski
Q
Question
After upgrading from Vtiger 7.0 to 7.1, the History widget on every record shows 'admin' as the user for all changes, regardless of which user actually made the change. This breaks our audit trail completely.

Is this a known bug? Is there a fix or is a hotfix planned?
A
Community Solution
✓ Answered
This is a confirmed bug in Vtiger 7.1 where the $current_user global is overwritten by the workflow system before the ModTracker handler reads it.

Fix 1 — ModTrackerHandler.php (recommended)

Edit modules/ModTracker/ModTrackerHandler.php.

Find the handleEvent function. Replace:

php
global $adb, $current_user;
$userid = $current_user->id;


With:

php
global $adb;
$curid = isset($_SESSION['authenticated_user_id'])
? (int)$_SESSION['authenticated_user_id']
: 1;
$userid = $curid;


Fix 2 — WSAPPAssignToTracker.php (workaround)

In modules/WSAPP/WorkFlowHandlers/WSAPPAssignToTracker.php, inside handleEvent(), comment out:

php
// $current_user = $user; // ← this line overwrites the global


Root cause: Vtiger overwrites $current_user in the workflow handler to run actions as the assigned user, but this breaks the audit trail for the same request.

Community Replies

W
wedger Accepted answer
Fix 1 worked perfectly on our Vtiger 7.1 install. Applied it to 8 servers. The history widget now shows the correct user immediately with no other side effects noticed after 3 months.
A
alexchen
Still present in Vtiger 7.4 and 8.x on some configurations. Check whether your installation also has modules/VtigercronTask.php overwriting the same global.
← Back to General Join to answer →