Allow Edit/Delete on your own posts ONLY

How can I allow edit/delete posts (data) created by the logged in user only?

A Post can be created and viewed by all users but I only want to allow edit/deletion on your own posts.

I’m finding that when I allow edit/deletion in the details page it allows everyone to edit/delete

You have to set it up so the user can only see his posts on one sheet view. You create a second sheet using an array formula and essentially clone the one sheet to another. The other sheet is the one that you set so everyone can view the rows of data.

This is controlled under Properties/Features User Data. The checkbox would be set on for the main sheet where the data is actually stored. The other cloned sheet would have this turned off.

2 Likes

thanks @George_B but I’m trying to get my head around your suggestion, I am only new to Glide so my apologies in advance :slight_smile:

If I understand you suggestion correctly, when a user creates a new post it is created in the"Public" sheet (where all posts can be seen).

The “Public” sheet is then cloned into a new “Private” sheet which is used for displaying per-user data by ticking the box ‘Filter rows by signed-in user’ found in the Properties/Features as you’ve said.

Question:

When a user edits a post in the cloned “Private” sheet, how do I ensure that it is replicated back to the “Public” sheet so that everyone else can view the latest edit?

I think you have the right idea, but instead of cloning the Public sheet into the Private sheet, flip it around and make the Public a clone of the Private sheet.

1 Like

thanks for your input @Jeff_Hager , this is making more sense…

Following this approach does this mean that when a user adds ‘+’ a new post it needs to be added in the Private sheet?

In my UI setup I have a “My Posts” view within the side hamburger menu SO it means the user needs to navigate to see their posts view to be able to add a new post (not ideal).

The Public sheet is in tab view easily visible and having the ability to add from that view is the most ideal.

Is there a way to display all posts and have the ability to add new ones from the same view and still achieve the ability to only be able to edit your own posts?

Yes, it would be added to the Private sheet.

To fix your UI issue, I would first create a placeholder sheet. You can put one heading in it so it’s at least recognized by glide. You will display a tab for the new sheet and you can hide the tab for the public sheet. Change the layout of that new tab to the Details style. Next you will add a Form Button that will be used to add a new record to the Private Sheet. Finally add an inline list component that will point to the Public Sheet. I personally like the look better than the + button in the upper right corner.

yes I like that :slight_smile: do you have a link to a sample app in the screenshot so I can see how its been setup?

Check out the Notes demo in https://concepts.glideapp.io/

There is a link to the sheet at the bottom and you can copy the app.

Jeff is correct. The private sheet is the one that your logged in users would be able to edit and add to via a Form.

Excellent thanks to you both @George_B I have been able to get it to work :slight_smile:

Glide Devs, is this the way this will always work? Or do you have an easier solution coming? This approach is basically cutting an app’s allotted rows in half since you’d have two sheets with the same data but Glide would see both sheets as a separate set of rows. For apps that expect a lot of user-generated data (like say a micro-blogging platform a la Twitter) this could be painful against the 25k rows for Pro Accounts. It would be nice if the Edit button option also came with a conditional filter (e.g. IF {User’s Email Address} is {some Column in the current Sheet})

No, you don’t need to do this anymore. You can make two tabs for the same sheet, where one only shows posts by the user who made them, and allows editing.

@david that doesn’t work for me at all. I just created two tabs pointing to the same sheet. One of them I have filtered by signed-in user. That one I selected “Allow users to edit” and the other tab now shows all posts as editable.

Additionally, most of the data I want users to be able to edit are in in-line lists. And those are behaving the same. If I create two Inline-Lists pointing to the same sheet and have the content editable in one, it will be editable in the other as well. So filtering one list by signed in user doesn’t help there either.

Am I perhaps misinterpreting your instructions?

1 Like

My bad, perhaps this is not yet rolled out but we’ve tested it. Regardless, we have a feature called Screen Variants that will allow this, although it’s still in R&D.

Oh, nice! :raised_hands: Screen variants will open up some features for some of us and ease flow dramatically! And I bet character limits on text fields are coming shortly after! Ha! Just kidding.

You guys are doing an amazing job with this product.

any update on this the SCREEN VARIANTS?

It looks like something I could use!

Hello! And it is possible in more detail, how can I make a button so that I can disable the publication of my a post? And right away the second question, how to still allow ordinary users to edit only their posts that they created? Thanks you!!!

If you don’t want a post to show right away, you can add a checkbox to the form and leave it empty when submitting. Wherever your posts are displayed, you can add a filter to only show items in the list where the checkbox column is ‘true’.

To allow users to only be able to edit their own posts, set a condition on the edit function to only show when the email in the post ‘is signed in user’.