This is all super helpful! I appreciate the info as it will help me with other projects in the future as well.
I’ve just tried again, but no luck so far. It seems there is one part of the code I am really struggling with. Right now the only way I know how to set the criteria for the badge is what is shown in the API reference, which gives an entire array of ID’s instead of a single member ID. This is what I have:
//Query the forum posts to find the owners of posts with more than 50 likes.
wixData.query("Forum/Posts")
.gt("likeCount", 50)
.find()
.then((results) => {
if(results.items.length > 0){
const topPosts = results.items;
// Then Assign those post owner ID's to an array that is passed to the backend function which will assignMembers badges
const topPostOwners = topPosts.map(post => post._ownerId);
assignMembersBackendFunction(TenuredBadgeId, topPostOwners);
//
The problem here is that I don't know how to only send the currently logged-in member ID to the backend function... I can only seem to find examples where the query produces an array of Member Id's which I seemingly cannot continue to filter down to a single member.
My knowledge is sadly limited and I’m really struggling to understand how to incorporate specific Badge criteria into the code without producing an entire array.
Is it possible to further query the array?
I need to determine if the currently logged in member is in the array, and then if so, send their memberID to the backend function?
Maybe there’s a different way to do the original query altogether?
Thanks Amanda!