Page MenuHomePhabricator

Add 'UserPreferencesChanged' hook - good for logging.
Closed, ResolvedPublic

Description

Author: bugzilla

Description:
Would it be possible to add a hook in 'SpecialPreferences.php' to trap changes in user preferences?
[[mw:User:Jldupont]]


Version: 1.10.x
Severity: enhancement

Details

Reference
bz10543

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 9:49 PM
bzimport set Reference to bz10543.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Jul 11 2007, 5:20 PM

robchur wrote:

What hook parameters?

bugzilla wrote:

I would suggest something along the following lines:

<code>wfRunHooks( 'UserSettingsChanging', array( $this, $wgUser ) );</code> at the ~ top of 'SpecialPreferences::savePreferences'; this way, the event handler function can have access to the 'before' and 'changed' parameters.

ayg wrote:

I don't think there's much point in passing a global to a hook. It can, after all, just access it itself.

bugzilla wrote:

(In reply to comment #3)

I don't think there's much point in passing a global to a hook. It can, after
all, just access it itself.

True, assuming this event will only be triggered at this one place, but what about other potential places? E.g. what about a 'Special Page' of some nature that allows modification to some other user's preferences?

Just a thought.

ayg wrote:

Okay, yeah, I agree with that. Cut down global use where possible.

demon added a comment.Sep 18 2008, 8:51 PM

The SavePreferences hook was added in 1.11 (sometime between this bug and 10 Sept 2007)