user statuses with profile info

ive been trying to figure out what would be the best way do display user statuses writen from their profile. custem made on dynamic page.
ive got two databases- one for the user profile data, and one for the statuses that are writen from a lightbox that pops up from their profile page.
i would love it if their would be a way to show the statuses in a newsfeed and having the prifile picture and full name of the writer
i got a newsfeed with the statuses but i cant get the profile data connected.
i realy need help.
thank you, michal

the image and status are connected and shown but the full name and profile picture show as they do in the editors repeater.

Hello, מיכל שושני :raised_hand_with_fingers_splayed:

You need to get the owner ID, and query the members collection to get the nickname (First and Last), then display it in the repeater.

NOTE: The Members collection is read-only for members to see only their own data, if you want to display multiple users’ data at once, you need to query the collection from the back-end with SupressAuth set to true .

Hope that helped.
Ahmad

thank you so much for your response.

what your saying makes so much sense :slight_smile:
do you have an example code for doing that?

ive been trying to get the email from the members and placing it in the collection.
it didnt work out using this code.

thanks again, michal

Hi, מיכל שושני :raised_hand_with_fingers_splayed:

You need to create or use an existing web-modules, ending with .jsw
Then write a function in that module that accepts the user ID as an argument, then query the Members collection and ONLY return the user data that you need, e.g.: Nickname, photo, etc…

1. BACK-END Code

import wixData from 'wix-data';
import wixUsersBackend from 'wix-users-backend';

export function getMemberNameAndPicture(ownerID) {

 // This bypasses the permissions check so the query can run for any user, not just the Member who owns the asset
 let options = {
 "suppressAuth": true
    }

 // This runs the query with the above option in place and finds the Member who's ID matches the _owner ID of the Item displayed on the dynamic page
 return wixData.query('Members/PrivateMembersData')
        .eq('_id', ownerID)
        .find(options)
        .then((result) => {
               let item = result.items[0];
               let member = {
                      name: item.nickname,
                      picture: item.picture
               }
               return member;
        })
}

2. FRONT-END Code

// Import the module from the backend
import { getMemberID } from'backend/Members.jsw';

// Create a function to call later inside the repeater function extractMemberData(id) {
    return getMemberID(id).then((results) => {
        let item = results.items[0];
        /* assign it to the first result,
        which is the only one anyway */
        
        let result = {
            pic: item.picture,
            nickname: item.nickname
        }return result
    })
}

Now use this function to get each user (item)'s data from the repeater and display their details accordingly.

I hope that help.
Ahmad

amazing!!! thank you for being so kind :grinning:
ill try that and ill let you know…

You’re welcome :blush:
Please also read the Community Guidelines . It will help you write comments/ replies, code, etc … in a better way.