How to get old value of login

Discussion in 'Customization & add-ons' started by bmedwards, Aug 17, 2015.

  1. bmedwards

    bmedwards New Member

    Joined:
    Jun 27, 2014
    Messages:
    16
    Hi,

    I am working in both the USER_AFTER_UPDATE and PROFILE_USER_UPDATED hooks. I want to be able to trap when a user changes just their username, so I can update a username in another system, and I will also need the old value of the username so I can perform a lookup based on the old username.

    Does anyone know how to pull out what field got updated, and the previous value of the field? I see that is gets populated and sent in a system email, but I cannot seem to find out how to implement it in my site.php.

    Thanks in advance,
    Brian
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello Brian,

    In your event handler please use:
    PHP:
    $old $event->getOldUser();
    $old->login;

Share This Page