How to send data from the frontend (users-permissions) to the backend

System Information
  • Strapi Version: v4.11.7
  • Operating System: macOS
  • Database: MySQL

I would like to add a checkbox in users-permissions when creating a new user, so that the user credentials are sent by email when the checkbox is checked (the password is only visible when the user is created). For this I have written a plugin that adds a checkbox to the frontent. In the backend (extensions/users-permissions/content-types/user/lifecycles.js) I created the function beforeCreate(event).
Frontend and backend work as intended.

My problem is how can I send the value of the checkbox from the frontend to the backend.

Bildschirmfoto 2023-07-29 um 22.52.27

Does anyone have any idea how I can implement this or is there any documentation about it?


Hey @Igor,

I have a question, do you want to send the credentials email to the user only after account creation OR you also want it after credentials update from the user profile?

Hi @Shekhar,

currently I want to send the credentials only after the account creation, because after that the user can update his password himself via “Forgot your password”. I need this functionality only because of the password.

Do you have an alternative idea how I can realize this? I am free in how I implement in that regard.
I currently have a solution, but it’s not very pretty/professional because I insert a prefix string in the email and delete it again in beforeCreate :grinning_face_with_smiling_eyes:

Well, I had similar kind of requirement in the past and I already had a solution for that.

What I actually developed is that whenever any user is created from the Frontend or from strapi, an email is executed from the index.js file using afterCreate() hook.

As your requirement is quite similar to mine so just go with the above flow.

Let me know if you need any more help here :slight_smile:

Hi @Shekhar

thanks for your solution, but the email should not always be sent.

In a nutshell: we have built a kind of “news portal” for many business customers. When a customer decides to book the service, first the users are created (without sending an email), the account is set up and tested. When the service is activated some time later, all credentials are sent at once. We need this functionality only for individual stragglers (hence the checkbox).

How is the service activated in your site? Do you activate if from the strapi?

No, we activate the service by enabling a subdomain