Search code examples
htmlvelo

Unique link specific to site member on Wix website needed


I have used Wix.com in the past for projects but I am stuck on a particular issue with my current site.

I have a Wix template website with the standard subscription set up for customers. It has the standard associated members pages supporting it. I want to grant each member access to a document (via link) specific to them only and that is private to all other members. Eg:

User 1 link: www.testweb.com/abc1 User 2 link: www.testweb.com/abc2 etc

Ideally I wanted a member page containing the link relating to the logged in user.

I tried using the Wix CMS with 2 fields: user email and document link, but can't see how to integrate this into the member page template.

I then investigated using the File Share app. I could fudge it by setting up a hidden folder for each user, which contained a file with the user-specific link. This is not a nice user experience and also the user has to download the file, they can't just view it (is this a wix bug?, just a side comment).

I have some coding experience but I am trying to keep this within Wix's template capabilities as I will be handing this over to someone to run and it just keeps things simple. Wix is the only option for now (for a number of reasons) I am afraid.

Any help or pointing in the right direction would be appreciated.


Solution

  • Actually, using a standard CMS table - the URLS work.

    and much simpler code just filtering the dataset on id.

    import { currentMember } from 'wix-members-frontend';
    import wixData from 'wix-data';
    $w.onReady(async function () {
      let id;
    
      currentMember.getMember()
        .then((member) => {
          id = member._id;
          $w("#dataset8").setFilter( wixData.filter()
      .eq("userId", id))
    // ...
        })
    });