Limiting User Clicks on an Image Generator Button to Three Attempts

Hello everyone,

I’ve developed an image generator that triggers a new user registration and creates an image each time its activation button is clicked. My goal is to restrict each user to a maximum of three button presses.

Questions:

  1. Should I create the user account before initiating the image creation process?
  2. How can I ensure that the number of times a user can click on the image generator button is limited to only three?

I’m looking for advice on the best practices for implementing these limitations within my application. Any suggestions or insights on how to effectively manage user interactions and restrict button clicks would be greatly appreciated.

Thank you in advance for your help!

you do need a counter to check the number of clicks, for that I would create a field in side user, thus creating a user account before. and then checking ‘current_user_limit is_not → 3’

2 Likes

Yes generate the user profile first.

Do the images get stored on there profile in a list? If so use the count of that list as a conditional rule. If not, what happens to them / what’s the function?

1 Like

Ok , generate the user profile first got it !

The images are not stored in a list; they are simply saved within an image file. Should I change the data type to a list?

Thanks !!

Can you further explain how to create the field within the user?

and how can i count this

All depends what you’re planning on doing with the app.

Just that if you are keeping them in a list, then you can use the count of that list as a conditional rule

1 Like

I will keep them

@sosogolan Look, what @Oliver-wholegraintech meant, was if in your case they are on a list.

Now, If you are generating an Avatar for a user or something, and previously generated images are not required by the user you can keep the latest image in a single field, and also have a count field, to count the number of generated images.

But if the user required all the images he generated, you will probably be saving them in a list. in this case, you don’t need a count field, just count the number of images in that list if they are more than what you allowed, simply make the generated workflow not run.

The thing you need to do is have a condition on that button which is generating the images, that say,

With a list of images.
Current user list of images.count => 3 : Dont run — For this you don’t have to maintain a counter filed seperatly.

Or with a counter
current user countervalue is =>3 : Dont Run — For this you have to maintain a counter and also need reset it if you required it.

2 Likes

I’ve understood your instructions, and they indeed worked. Now, I’m encountering a new issue. Whenever I create a user, I can’t seem to associate the image list with that specific user. It always defaults to the first user.

I aim for each user to have their own list until they reach three images, at which point I would know to restrict further additions ?

As an example, Aston Martin was the first user I created. Subsequent users appear, but every image is logged as if Aston created it, automatically adding to his list.

Yep what @Baloshi69 said :slight_smile:

Whats your workflow for assigning the image to the list?

1 Like

Currently, my challenge is to create a user who has a list of images associated with them in their data.

Then, when I press the create image button, a change is made to the image list, and an image is added to the user.

I asked myself, do I need to hold a variable in order to store the additional images?


When I held a static variable stating that the phone number = “1111”, and then I entered “1111” in the phone number input, I was indeed able to save the additional images.

Should I use set state to hold a temporary variable?

Well I would be using the “Current User” here since it should just be the user who is actually clicking the button right? rather than doing a search for a user

1 Like

I tried, but it’s still not working. It only saves the first image. I think it’s because it’s losing the current user and can’t find whom to assign the data to.

how can i save the user more then 1 time