• Hi,

    I am one issue in the Reset Email.
    Consider, Currently i am in Edit account page, going to reset my email id. After reset email, mail will trigger. After reset email, the WP_User Object wp_get_current_user() returns the old email id in user_login field.
    https://prnt.sc/r3W4ddo1_DAE
    (Due to this, user gets logout when i refresh the page)

    But it is showing currently when i login fresh and second time after reset – https://prnt.sc/gKJCwUBGOUDP
    But showing old mail id after attempting reset and in my first login.

    Anyone can help?

    • This topic was modified 2 years, 3 months ago by hemasusi.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @hemasusi, I registered on the website using [email protected] then, changed to email+2@gmail, go to Gmail inbox, click accept change, and no logout.

    Then, (logged with [email protected]), edit email to [email protected], not visiting Gmail inbox and keep navigating the menus (account details, payment, preferences, etc…) and I was not logged out.

    I am not sure if I understand the problem correctly, but I am not able to replicate your error.

    P.S. I am using this generic emails accounts to explain, I can not share my real ones due to forum rules.

    Thread Starter hemasusi

    (@hemasusi)

    Hi,

    I will tell the replicate method.
    1. Login to one account
    Edit Email
    Reset Email
    Do any update (name, phone or address)
    Click Refresh- It gets logout

    2. Login
    Edit Email
    Reset Email
    Clearing cache in server
    Simply Refresh the page- It gets logout

    The problem here is WP object cache. The new mail id is storing in database but its not reflected in the site.

    WP considering only the User Name & Password for the login session. When user try to reset the email, the new email is updated to the database successfully. But that value is not reflecting into the front end (both admin & site). It will reflect only when we clear cache, when there is any first ajax update and when logout.

    1. Page refresh after clear cache will cause logout
    2. The first ajax request will update the new email to the front end. After that, the refresh will cause logout and the second ajax update is will cause stuck.

    I tried to clear cache after reset an email via code, but that’s not working with the server. So i contacted server team for this cache issue, they suggested ‘Pantheon Advanced Page Cache’ plugin to clear the cache. This is also not clear the cache during the run time.

    I want to know, how to use below code in the WordPress files to clear the run time cache.
    wp_cache_flush()
    or
    global $wp_object_cache;
    $wp_object_cache->flush();

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get current user result wrong Email ID’ is closed to new replies.