Thread Tools Display Modes
12-22-20, 03:47 AM   #1
artenides
A Defias Bandit
Join Date: Dec 2020
Posts: 3
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")?
  Reply With Quote
12-22-20, 07:01 PM   #2
DahkCeles
A Cliff Giant
 
DahkCeles's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 73
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
  Reply With Quote
12-22-20, 07:06 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Except please don't make it a global function, especially not with that name.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-23-20, 05:47 PM   #4
artenides
A Defias Bandit
Join Date: Dec 2020
Posts: 3
Originally Posted by DahkCeles View Post
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.
  Reply With Quote
12-23-20, 05:52 PM   #5
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
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.
  Reply With Quote
12-24-20, 12:48 AM   #6
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
12-24-20, 06:40 AM   #7
artenides
A Defias Bandit
Join Date: Dec 2020
Posts: 3
Originally Posted by gmarco View Post
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)?
  Reply With Quote
12-25-20, 12:44 PM   #8
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 12-25-20 at 12:47 PM.
  Reply With Quote
12-25-20, 01:28 PM   #9
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
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.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Show Guild Member promote frame from lua?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off