Approve user input content before it goes live (database)

Hi,

I have a user input form which uploads data to a collection. This data is then used on several dynamic pages across my site. Uploads include text and images.

Currently when a user uploads their data it automatically goes live onto the site. This is causing issues as often there is spelling mistakes and images become cropped/cut off on the templates i am using.

Is there a way to stop the data going live straight away? So that I can view it and send it live once formatted correctly?

Thank you
Ellie

1 Like

I have the same question…

Hi,
You can use hooks (before insert) to check the data, if the user input is wrong you can cancel the insert.
For example:

export function dataset1_beforeInsert(item, context) {
	let p = new Promise(function (resolve, reject) {
		reject("rejecting");
	})

	return p;
}

If you want to check the input manually before it goes live, save the data to a different database (which isn’t connected to a dynamic page) and check it yourself.

Good luck :slight_smile:

thanks i think it will need to be the latter as the hooks can’t check the images and how they are displayed. Is it straightforward to copy content from one collection to another? thanks

You can submit the content to another database(which isn’t connected to a dynamic page), and then after your approval, copy the data to the collection connected to the dynamic page, you can build your own admins area or you can do that manually.

What about adding a status field to the collection, that you use to indicate the item is in need of review (R) when the user makes any add/change, (A) after you approve it, and (P) after you publish it?

I like the idea of a status field. Is it possible to have a notification button - notify admin…?

i have the isuue with what the code need to let the admin approve or reject the pending teacher in custom admin dashboard and the required design and where i should replace the id of my UI elements: