I’m using a repeater to display comments made by different users, I created an edit button in the repeater so every registered user gets to edit their own comments after post if they so choose to. Problem is everyone is able to click on any edit button wether they typed the comment or not, how do I show only the buttons for the comments made by the current user viewing the page and hide the others? Is that possible?
Here’s what I got:
- I’m working on dynamic page, the URL contains the user id.
2.The user’s image, email, ID, etc… are being stored in the ‘Afiliados’ collection. - I set the button to be hidden on load and enabled it by default in the properties panel.
- The comments are being stored in my ‘Comunidad’ collection, as a result each comment has its own URL and its own ID (that’s separate from the user id)
- When each user makes a comment the user id gets inserted in the title field of my ‘Comunidad’ collection and an ID is also generated for each comment.
import wixData from 'wix-data';
import wixUsers from 'wix-users';
$w.onReady(function () {
const currentUser = wixUsers.currentUser;
if (currentUser.loggedIn) {
currentUser.getEmail().then(email => {
wixData.query('Afiliados').eq('email', email).find()
then(() => {
$w("#repeater1").onItemReady( ($w, itemData) => {
itemData=$w("#button13").show();
});
});
});
}
});
When I view the page I can see the repeater is showing all of the edit buttons and not just the ones that belong to the comments made by the current user.
Could anyone help me out on this one please?
Thanx