- Strapi Version: 3.6.8
- Operating System: Ubuntu Server 20.04
Dear Strapi community,
I have a wordpress instance for listing shops using Directories Pro plugin and a Strapi instance with React frontend as customer control panel for shop owners. Now I would like to synch data between wordpress and Strapi for following cases:
User is created in WP => create the user in Strapi
User changes his data => change them in Strapi
A new shop is added in WP => add it in Strapi
User buys a subscription => save the expiry date to Strapi
I was wondering what would be the best way to do this. Some solutions came to my mind, but each has his own disadvantages:
Make a WP plugin and use Strapi API
=> For example use the user_register hook and call the Strapi API in a php function to register user. The problem is, how can I get the password to send it to Strapi? An other problem is that Directories Pro is using own tables in database, so I have no idea how to access them or how to hook into the creation process.
Use WP Webhooks plugin
=> Make a webhook listener in Strapi and use the WP Webhooks plugin to send data to it. But again, same problems here.
Use WP REST API from CCP login script
=> Each time a user tries to login to CCP, compare the data to WP via REST API and if the user does not exist in Strapi, create him with data from WP REST API in Strapi. This solves the password problem, but creates a new one… What if the user exists in Strapi and has changed his password or email in WP in the meanwhile? And how can I access his subscription status?
Or is there maybe a completely other solution for this?
Many thanks for your time!