How do I retrieve the current users slug to use for this code?

Down below is my subscriber code that I’m using in my social media site that I made through Wix and I need help with the part of the code that’s colored in blue.

import wixUsers from "wix-users"
import wixData from "wix-data"
export function button50_click(event) {
 // let's get the userIds
 const subscribeeId = $w("#dataset7").getCurrentItem().channelname
 const subscriberId = wixUsers.currentUser.id
 const user = $w("#dataset8").getCurrentItem().slug
 
 // save them to our "Followings" collection
   wixData.insert("VJ-Subscribers", {
 "subscribeeId": subscribeeId,
 "subscriberId": subscriberId,
 "user": user
    })
    .catch((err) => {
 // to help you debug if something went wrong
        console.log(err);            
    });
}

Hello James,

your dataset8 is connected to ??? —> “PrivateMembersData”, or where do you have located your slug?

Normaly you will find the slug in the “PrivateMembersData”, that mens you have first to get it from there. How to do it, you will see here…
https://www.wix.com/corvid/reference/wix-users-backend/getuser

Yes that’s where the members data is located.

Then the given link is the right one for you.

  1. Get with the help of the given code-command your slug-info.
  2. Then do with it what ever you want.:grin: