View Single Post
08-02-20, 01:48 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
The addon Blizzard_Communities is LoadOnDemand. Out of all actions in the UI that load it, the one that usually gets it first is when your chat channel list updates in FrameXML\ChannelList.lua:101

Lua Code:
  1. function ChannelListMixin:Update()
  2.  
  3. ...
  4.  
  5.     -- Then add community streams
  6.     local clubs = C_Club.GetSubscribedClubs();
  7.  
  8.     Communities_LoadUI(); -- here
  9.     CommunitiesFrame.CommunitiesList:PredictFavorites(clubs);
  10.     CommunitiesUtil.SortClubs(clubs);
  11.  
  12. ...
  13.  
  14. end

The event you want is ADDON_LOADED after force-loading Communities at login:

Lua Code:
  1. local frame=CreateFrame("frame")
  2. frame:RegisterEvent("ADDON_LOADED")
  3. frame:RegisterEvent("PLAYER_LOGIN")
  4. frame:SetScript("OnEvent",function(self,event,arg1)
  5.     if event=="ADDON_LOADED" and arg1=="Blizzard_Communities" then
  6.         ChatFrame_AddChannel(DEFAULT_CHAT_FRAME,"Community:XXXXXXX:1")
  7.     elseif event=="PLAYER_LOGIN" then
  8.         Communities_LoadUI()
  9.     end
  10. end)

You don't need to call ChatFrame_RemoveChannel. It's possible that the act of toggling the community loads Communities and for some reason Blizzard doesn't load Communities appropriately at login.
  Reply With Quote