Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ultimate Member

    (@ultimatemember)

    Hi,

    Can you please provide steps so we can try replicate this?

    Thanks

    Thread Starter jkester1986

    (@jkester1986)

    Actually it looks like a hook I created – based on your um_account_pre_update_profile hook. We are trying to tie our site passwords to our Openfire database, which had been working great until sometime recently. Code chunks below:

    /*this is where we set up our own hook*/
    add_action('um_account_pre_update_profile', 'manage_subscriptions', 9, 2);
    function manage_subscriptions($changes, $user_id) {
    	global $wpdb;
      $data = get_userdata($user_id);
      um_fetch_user($user_id);
      $email 		= um_user('user_email');
      $fullName 	= um_user('display_name');
      $username 	= um_user('nickname');
      $emailChange  = $changes['user_email'];
    
      //deal with pw reset
    
      if(isset($changes['user_pass'])){
    	//$message = $username.$changes['user_pass'];
    	$pw = $changes['user_pass'];
    	//mail("[email protected]", "password changed", $message, "From: [email protected]");
    	do_action('trigger_pw_change', $user_id, $pw);
      }
      /*more stuff happens here but we are only concerned about the do_action above right now*/
    }
    //Where we will set the pw change in openfire
    add_action('trigger_pw_change', 'openfire_password_update', 10, 4);
    function openfire_password_update($userid, $pw) {
      global $ultimatemember;
      global $wpdb;
    
      um_fetch_user($userid);
      $username = um_user('nickname');
      $displayName = um_user('display_name');
      $email = um_user('user_email');
    
      //todo
    
      $message = "User Id: ".$userid."\nUsername: ".$username."\nFull Name: ".$displayName."\nPassword: ".$pw.$email;
      mail("[email protected]", "Password has been changed", $message, "From: [email protected]");
    
      /*
      stuff related to the openfire changes goes here
      */
    
      delete_option( "um_cache_userdata_{$userid}" );
    }

    When users reset their password via the password reset form, the email message gets sent. When they do it from their profile, no email is sent. (By the way, the email part is usually commented out – it’s used for debugging purposes only)

    Thread Starter jkester1986

    (@jkester1986)

    Anything further with this? Tried to get an output of the $changes key/value pairs and nothing related to a password even shows up. Did you guys change/remove the hooked tied to password changes?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi,

    You can replace it with the following action hook:

    add_action("um_change_password_process_hook","openfire_password_update");
    function openfire_password_update( $args ) {
    
          $user_id = $args['user_id'];
          um_fetch_user( $userid );
          // do more stuff
    
    }

    Regards,

    Thread Starter jkester1986

    (@jkester1986)

    Thanks!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know. Marking this topic as resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘hook not firing’ is closed to new replies.