1. Hello guys, I need a help with this bunch of code. Itsi s designed to show class icons instead of portrait for players, and if the player is druid, then show his shapeshift icon. However, I could only get this working for player himself, it still shows class icon for target/focus druids.

    hooksecurefunc("UnitFramePortrait_Update",function(self)
        if self.portrait then
                if UnitIsPlayer(self.unit) then
                    if select(2,UnitClass(self.unit)) == "DRUID" then --if player is druid
                        local i, flag=1, false
                        while UnitBuff(self.unit, i) do
                            local id = select(11,UnitBuff(self.unit, i))  --768 (Cat Form)  783(Travel Form) 1066 (Aquatic Form) 5487 (Bear Form) 24858 (Moonkin Form) 33891 (Tree of Life) 33943 (Flight Form) 40120 (Swift Flight Form)
                            if id == 768 or id == 783 or id == 1066 or id == 5487 or id == 24858 or id == 33891 or id == 33943 or id == 40120 then
                                SetPortraitToTexture(self.portrait, GetSpellTexture(id));
                                self.portrait:SetTexCoord(0, 1, 0, 1)
                            flag = true
                            else --if not in form
                                local t = CLASS_ICON_TCOORDS[select(2, UnitClass(self.unit))]
                                if t then
                                        self.portrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
                                        self.portrait:SetTexCoord(unpack(t))
                            end
                        end
                        i = i + 1
                    end
                    else --if player not druid
                        local t = CLASS_ICON_TCOORDS[select(2, UnitClass(self.unit))]
                        if t then
                                self.portrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
                                self.portrait:SetTexCoord(unpack(t))
                        end
                    end
                else --If NPC
                        self.portrait:SetTexCoord(0,1,0,1)
                end
        end
    end)