skip to Main Content

I want to create users in wordpress using an ETL (Talend). The ETL will create users direclty in the mysql database (table: wp_users).

How can I make wordpress send welcome emails for those users created directly in the database.

I give it a try by creating a user manually using php-myadmin, and I can see that the new users does not receive any welcome emails.

2

Answers


  1. Chosen as BEST ANSWER

    Thanks Dexter0015.

    I tried the Wordpress API option: I was not able to authenticate using Talend for some reason. After many retries I skipped this option and moved to the next one.

    Option 2 was to use CRON code to insert users from table#1 to table#2 and it worked. I used a plugin called WP-control to create the cron, and I used PHP code to do two things:

    1. Insert the user in the database
    2. Send an email to the created user (as the welcome email was not sent automatically)

  2. Your issue is linked to the fact that you directly insert the user in your database.

    By doing so, you completly bypass wordpress procedures, that’s why no welcome email is sent to the newly created user.

    A better approch would be to request the Worpdress Rest API to create your user (didn’t test it though): I think it would trigger email sending.

    If you can’t process that way, maybe you can create a plugin that register a new cron inside wp cron system (since Wp_User has an attribut user_registered containing the datetime on whish the user has been created. You can use this to detect new user).

    Though this second approch has an issue too:
    If a user can also register from the website (using the register form of wordpress), you will proentially send a welcome email in double to thoses users because your cron won’t have any clue how the user was created (from wp or direct in in db).

    A way to avoid this would be, when creating the user directly in DB, to add a custom user meta (wp_usermeta table) so you can "tag" the users created directly in Db to be able to indetify them in your cron.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search