Skip to content

fix detailed logs not showing user ID - #369

Open
MegaphoneJon wants to merge 1 commit into
civicrm:masterfrom
MegaphoneJon:detailed-log-user-id
Open

fix detailed logs not showing user ID#369
MegaphoneJon wants to merge 1 commit into
civicrm:masterfrom
MegaphoneJon:detailed-log-user-id

Conversation

@MegaphoneJon

Copy link
Copy Markdown
Contributor

Overview

If you have detailed (trigger-based) logging enabled in WordPress, it no longer records the user ID who instigated the action. This regressed at least 6 months ago.

To replicate: Enabled detailed logging on WP, then make a change (in the web UI, so a user ID is associated with the change). The change will be recorded, but log_user_id will be NULL.

Before

No user ID recorded.

After

User ID recorded.

Technical Details

The user id is set by a SQL statement in CRM_Core_Config::authenticate(), which is called during CRM_Core_Config::singleton() (called on line 502) - but only the first time it's instantiated. But the user ID isn't known until CRM_Core_BAO_UFMatch::synchronize() is called (line 510). So we call authenticate() again to set the user ID correctly.

@kcristiano kcristiano self-assigned this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants