System Information
- Strapi Version: 3.5.4
- Operating System: localhost (Mac OSX 11.2.2 (20D80))
- Database: 10.5.6-MariaDB-1:10.5.6
- Node Version: 14.6.1
- NPM Version: 6.14.12
- Yarn Version: 1.22.10
Good evening,
I hope this is the correct section for my problem. I have got a problem with the user-permissions plugin.
Problem:
I have got users and companies. Every user can have many companies and one company can have many users. So I’ve got a many-to-many-relation. It was no problem to create a many-to-many-relation between users and companies. But now I have to add another field to the many-to-many-relation table named confirmed
. After registration the field has to be set als 0
. In my database I’ve added a new field confirmed
with the data type TINYINT(1)
. Additionaly I have added some new fields to my users model, e.g. forename, lastname etc. This fields are perfectly saved in ./extensions/users-permissions/models/User.settings.json
.
Now the problem: I wanted to create a file named User.js
in ./extensions/users-permissions/models/
where I can add some logic for setting the field confirmed
in my many-to-many-relation table. I have added something like this:
'use strict';
module.exports = {
lifecycles: {
// Called before an entry is created
afterCreate(data) {
console.log("Test");
return "Test1"
},
}
};
but nothing is fired. I don’t see the problem and I hope, someone can give me a hint.
Thank you!
Best,
Thorsten