Leave a Reply

1 comment

  1. You do not specify a plugin you are using. But if a user login with a OAuth (used by the mosts social plattforms), then he cannot be logged in in WordPress.

    Why?

    A user needs a username and password to login. OAuth (and other methods) do not provide a password. They only answers with Yes, this user is authorized or No, not authorized.

    The social login plugins need a method to re-identify the user if he request a new page from the blog. They have to store something that tells them This user is logged in. WordPress use a cookie. Another method is to start a session. A bit exotic method could use the database and the ip adress. I don’t know how your social login plugin re-identify the user,but this is a important point to find out why your formular doesn’t work.

    Why is the user not longer logged in?

    I guess the plugin lose the connection to the re-identify method. Means, cannot read the cookie or the session is stopped/destroyed.

    Possible solution

    When displaying the formular and if the user is logged in with a social login, register a new user in WordPress and log this user in. This could be a dummy user and do not need a real username. Check if the current user is logged in with a social log in, fetch the userdata (e.g. username),create a hash from this userdata, use this hash as username and password. The next time the user logged in with the social login, hook into this process, grab the userdata, create a hash and check if a user with this hash exists.

    You can also try to find out how the social login re-identify the user and why he isn’t re-identified after the formular is finished.