Of course GetGuildId() will always return 1 when you use it like that. It requires the guild index as a parameter:
Lua Code:
for i = 1, GetNumGuilds() do
local guildId = GetGuildId(i)
end
And I don't know why you use GUILD_SHARED_INFO.guildId when I showed you a working piece of code?
In my example I use self.guildId, where self is GUILD_ROSTER_MANAGER. GUILD_ROSTER_MANAGER.guildId is updated before OnGuildIdChanged is called, so in the prehook you already get the new id that way.
Lua Code:
function ZO_GuildRosterManager:SetGuildId(guildId)
self.guildId = guildId
self.guildName = GetGuildName(guildId)
self.guildAlliance = GetGuildAlliance(guildId)
self:OnGuildIdChanged()
self:RefreshAll()
end