It seems like "UnitIsInMyGuild" only checks for those players in your guild with the same realm.
It returns "false" whether you check their realm or not.
For example, your name is AAA-BBB, one of your guild members named CCC-DDD.
Both UnitIsInMyGuild("CCC") and UnitIsInMyGuild("CCC-DDD") would return false.
UnitInRaid and UnitInParty won't support realm info either.
Your name is AAA-BBB, your party member is CCC-DDD.
Both UnitInRaid("CCC") and UnitInRaid("CCC-DDD") return true.
The following code is what I am currently using to check my members.
Code:
local UnitInGuild = function(unit)
for i = 1, GetNumGuildMembers() do
local name = GetGuildRosterInfo(i)
if name and name == unit then
return true
end
end
return false
end