Hi Andrew,
1 - set up your database like on picture below:
Jmeno = nick or name
Komentar = comment
foto = foto of the author which comment the photo
reference = id
2 - set dataset permission for: Anyone
3 - use this code:
import wixData from "wix-data";
export function KomRead_ready() {
let filter = wixData.filter();
filter = filter
.eq("reference", $w("#input2").text);
$w("#KomRead").setFilter(filter);
}
export function KomWrite_ready() {
$w('#KomWrite').setFieldValue('reference', $w('#input2').text);
$w('#KomWrite').setFieldValue('jmeno', $w('#input3').text);
$w('#KomWrite').setFieldValue('foto', $w('#image74').src);
}
export function save_click(event, $w) {
$w('#KomWrite').setFieldValue('reference', $w('#input2').text);
$w('#KomWrite').setFieldValue('jmeno', $w('#input3').text);
$w('#KomWrite').setFieldValue('foto', $w('#image74').src);
$w("#KomWrite").save();
$w("#KomRead").refresh();
}
4 - Set up 3 different datasets on your comments page

-
KomRead - leads to your Comments Database - set it up for read only
-
KomWrite - leads to your Comments Database - set it up for write only
-
Members - this dataset must be filtered as - Owner is Logged-in user
5 - Every one of those 3 datases must be connected to onReady function and have specific ID that you will use in code:
6 - Connect your nick and foto to Members dataset where you pull out your foto and your nick
7 - In all comments section connect foto and nick to KomRead dataset (read only dataset)
I believe that I gave you all necessary instructions you will need.
If you have any questions please read all comments section if anyone of us did not write it here. It’s already quite a big discussion with all necessary tips thanks to Mert and Tristan.
Don’t be a worry to play with the code as you wish and don’t give up.
Happy coding,
Jakub




