• I am writing a custom user profile edit page. Currently this is done as a plugin accessed by a short code.
    I want to update the password. However when this is done the user is logged out. I tried reseting the cookie for login using wp_set_auth_cookie to reset it but this gives an html error as it is trying to output before the header is output.

    Note being logged out although not ideal would be OK, however the ‘login with Ajax’ plugin I am using does not update so it is only apparent you have been logged out when you go to a new page.

    Any suggestion of how to make this work?. e.g can I include the code to reset the cookie in the text stream returned by the plugin function so it is output after the header?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    If you call wp_update_user to modify things about the user, such as the password, then it will handle the cookies for you.

    Note that your function which receives the form input and does the updating must happen before any output occurs. Once any output happens, you can’t set cookies anymore because you can’t send headers. So put your processing function early, like on the load-$page_hook action in the admin or some such.

    Thread Starter Malcolm Streeton

    (@malcolm-streeton)

    Thanks. However if I read it correct the load_page hook only relates to admin pages.
    I have the user profile on a normal page as I want to hide the wordpress admin area from the user.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Reset password cookie from Plugin’ is closed to new replies.