WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Show Guild Member promote frame from lua? (https://www.wowinterface.com/forums/showthread.php?t=58476)

artenides 12-22-20 03:47 AM

Show Guild Member promote frame from lua?
 
Hi people,

Is there a way I can open the promote/demote tab for a specific guild member from lua?

I found this code snippet that opens the guild roster:

Code:

    if not CommunitiesFrame or not CommunitiesFrame:IsShown() then
          ToggleGuildFrame()
    end
    CommunitiesFrame:SetDisplayMode(COMMUNITIES_FRAME_DISPLAY_MODES.ROSTER)

If I click on a guild member (Bob) a small frame opens on the right in which I can promote/demote (Bob)
Is there a method I could open this frame for Bob from lua? Something like OpenGuildPromoteTab("Bob")? :)

DahkCeles 12-22-20 07:01 PM

Your answer might be here:

https://www.townlong-yak.com/framexm...Roster.lua#361

I'm not in a guild, so I have no way to test... but would something like this do it?

Lua Code:
  1. function foo(guildIndex)
  2.     if (GuildFrame and GetGuildRosterInfo(guildIndex)) then
  3.         GuildFrame:Show()
  4.         SetGuildRosterSelection(guildIndex)
  5.         GuildFrame.selectedGuildMember = guildIndex
  6.         GuildFramePopup_Show(GuildMemberDetailFrame)
  7.     end
  8. end

Seerah 12-22-20 07:06 PM

Except please don't make it a global function, especially not with that name. ;)

artenides 12-23-20 05:47 PM

Quote:

Originally Posted by DahkCeles (Post 338011)
Your answer might be here:

https://www.townlong-yak.com/framexm...Roster.lua#361

I'm not in a guild, so I have no way to test... but would something like this do it?

Lua Code:
  1. function foo(guildIndex)
  2.     if (GuildFrame and GetGuildRosterInfo(guildIndex)) then
  3.         GuildFrame:Show()
  4.         SetGuildRosterSelection(guildIndex)
  5.         GuildFrame.selectedGuildMember = guildIndex
  6.         GuildFramePopup_Show(GuildMemberDetailFrame)
  7.     end
  8. end

This doesn't seem to work. :( I named the function OpenGuildMemberTab and called it with 1 that supposed to be the first member on the list but it didn't open the detail frame.

Kanegasi 12-23-20 05:52 PM

The guild member index is from 1 to the total number of guild members. The order of the index depends on the view settings of the roster window, but even then, there's no rhyme or reason for which member has which index, and the numbers change every time someone comes online, goes offline, joins, or leaves. 1 could be the GM or it could be some offline alt that hasn't logged on in months. You could try sorting the roster window, with offline members shown, to try to get reasonable index numbers.

gmarco 12-24-20 12:48 AM

Hi all,

very probably the thing you want to achieve is protected and so you have to take care about "Secure Execution" and "Tainting" or your code will triggers an error like:

"YOUR_ADDON has been blocked from an action only available to the Blizzard UI. You can disable this addon and reload the UI"

For more information you can check this:
https://wow.gamepedia.com/Secure_Execution_and_Tainting

Merry Xmas and Happy New year to everyone.

artenides 12-24-20 06:40 AM

Quote:

Originally Posted by gmarco (Post 338025)
Hi all,

very probably the thing you want to achieve is protected and so you have to take care about "Secure Execution" and "Tainting" or your code will triggers an error like:

"YOUR_ADDON has been blocked from an action only available to the Blizzard UI. You can disable this addon and reload the UI"

For more information you can check this:
https://wow.gamepedia.com/Secure_Execution_and_Tainting

Merry Xmas and Happy New year to everyone.


Kanegasi: Thanks!

gmarco: Initially I wanted to use the GuildPromote/GuildDemote functions to change a guild member's rank and that's when I got this "Your addon was blocked" message, hence my question regarding opening the guildmemberdetailframe programmatically. Are you saying that if I make my addon secure then I would be able to use GuildPromote (that would be preferable to be honest)?

gmarco 12-25-20 12:44 PM

Hi,

I am not so skilled but I think if you succeded in make your code taint free you could use the standard functions without have to rewrite anything.

Almost sure :)

Happy New Year to everyone.

P.s.

Edit:
Also one addon of mine that deals with guild have the same iussue.
If you click in the databroker you open the guild panel, but when you try to edit a guild member you get the taint error.

I really dont care so much because I use mainly to display them in a ldb, but if you find how to make this taint free please let me know :)

Thanks.

Xrystal 12-25-20 01:28 PM

It might not be your addons use of it that is causing taint.

nUI just makes the Guild frame movable and while nUI is active, whenever a person is new to the guild I have to reload the UI to promote them to the appropriate rank via this screen.

Maybe it is similar to the dropdown frame taint issues and any programmatic access to it outside of Blizzard introduces taint.


All times are GMT -6. The time now is 12:46 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI