• Resolved mor3311

    (@mor3311)


    Hi,
    Is there a way to get the new user id after user registration form is submitted, using php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mor3311

    I hope you’re well today!

    It requires some additional code but would be possible. Here’s the code that you can use for this:

    https://gist.github.com/adczk/4b119e2eb50756bb30d0866501bc08b1

    With this exact code you’d get user ID in userid variable in line 60.

    This particular code is meant to be used with forms that have both registration and postdata field on them, in order to register user, create post and then automatically assign that new user as post author. But you can easily change the code to work without postdata field (post creation); simply remove lines number

    41

    and from 62 to 71 (including).

    Best regards,
    Adam

    Thread Starter mor3311

    (@mor3311)

    I customized the code for my needs and it works, thanks!! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get new registered user id’ is closed to new replies.