Quantcast
How to fix GetDisplayName() / Saved Variables bug after patch 1.2.3
For some reason function GetDisplayName() does not work after patch 1.2.3. It breaks saved variables system and few other UI functions. Farangkao gave me an idea how to fix this issue - just copy&paste this code to the end of any .lua file in the addons folder:

Lua Code:
  1. local displayName = GetDisplayName()
  2.  
  3. --if display name is invalid
  4. if not IsDecoratedDisplayName(displayName) then
  5.    --try to get display name from the saved account name
  6.    displayName = DecorateDisplayName(GetCVar("AccountName"))
  7.    
  8.    --if display name is still invalid and player is in the guild, try to get display name from there
  9.    if not IsDecoratedDisplayName(displayName) and GetNumGuilds() > 0 then
  10.       displayName = DecorateDisplayName(GetGuildMemberInfo(GetGuildId(1), GetPlayerGuildMemberIndex(GetGuildId(1))))
  11.    end
  12.    
  13.    --if display name is valid, redefine broken GetDisplayName() function
  14.    if IsDecoratedDisplayName(displayName) then
  15.       GetDisplayName = function()
  16.          return displayName
  17.       end
  18.    end
  19. end