How to prevent user save loop in CP?
I had a similar problem a while ago when a plugin listened for onSaveUser and then saved the user itself, causing an infinite loop. Someone provided me something like:

craft()-&gt;on('users.onSaveUser', function(Event $event) {
    static $recursionLevel = 0;
    if ($recursionLevel == 0) {
        $recursionLevel++;
        // do your stuff
    }
});