question

vivecuervo7 avatar image
vivecuervo7 asked

ShowMembership in ProfileConstraints throwing "Invalid view constraints"

Little trouble regarding getting membership info. Started using entities today and was able to bring up my group info and display membership using the optional parameter when logging in - that much worked fine.

I'm wanting to be able to display Arena opponents and I do this using GetLeaderboardAroundPlayer(). Has been working fantastically - I use Statistics to store avatar customization, works really well. However, I'm also wanting to display the player's Guild. Now, as above I have managed to get Groups working well enough for retrieval for the logged-in player, but as for other players dragged from the leaderboard? My mind went straight to "ShowMemberships" under ProfileConstraints, as far as I can see, that's exactly what I need, that memberships are consistent regardless of using EntityToken or PlayFabId. Am I wrong in this assumption? Or just doing something else incorrectly?

ProfileConstraints = new PlayerProfileViewConstraints() {
                ShowDisplayName = true, ShowStatistics = true, ShowMemberships = true
            }

Above code is returning "Invalid view constraints", if I remove ", ShowMemberships = true" I don't receive any errors.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Memberships (subscriptions in iTunes/Google Play receipts) is a feature that has to be turned on for titles explicitly - it's not on by default. Once we have a tutorial available for this, we'll be providing info on how to turn this feature on more broadly. If you're a Pro or Enterprise tier customer, feel free to ping us at devrel@playfab.com and we can assist you with this ahead of broad availability.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vivecuervo7 avatar image vivecuervo7 commented ·

Ah, I certainly have misunderstood the use of Memberships in this regard then, thanks for clarifying that. What I was more chasing was that I would be able to grab a list of opponents via GetLeaderboardAroundPlayer, and then show aside from their DisplayName, avatar etc which guild that player belongs to - which as far I can see you'd need to get that player's Entity. In order to minimise calls, I was wondering if there was a way to get this information (hence why I thought "memberships" may have been what I was after) without needing to get the player's Entity - I'm now assuming easiest way may be to store the Group name as a key/value?

0 Likes 0 ·
brendan avatar image brendan vivecuervo7 commented ·

Well, the most immediate answer is that you should never try to loop over every player in a leaderboard response and to a call on every one of them to get more info. That would generate an excessive number of API calls and could result in the title being throttled. The Profile data is available to be returned as part of the leaderboard call, in order to give you the rich data you're looking for, for the leaderboard display. The Group a player is in isn't part of the profile (yet - if that's something you need, I'd recommend adding it as a Feature Request), but you could potentially use Tags for the additional info you need.

0 Likes 0 ·
qmira avatar image
qmira answered

Hello, we are having the same issue on our end and the email you gave to have support is not valid anymore. We already tried to tick every permission in the Client profile options in the title settings and still no luck. Also there is no Membership tick box there. Could you please describe the steps needed to enable that in our title?

Thank you very much for your help. Quentin

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.