• We would like to notify certain users (by sending an email) when a user updates their profile. How can we tell which fields have changed/updated on the profile update. I see a few hooks where we can send the email, but its not apparent to me that UM is sending the old and new user profile values in the hooks. Is there a hook where I can see the fields that have changed, or at least compare old to new?

Viewing 5 replies - 1 through 5 (of 5 total)
  • @ftballguy45

    You can try this hook where you can compare $to_update with current values for $user_id either from the UM Cache or read from the DB.

    /**
    	 * UM hook
    	 *
    	 * @type action
    	 * @title um_user_pre_updating_profile
    	 * @description Some actions before profile submit
    	 * @input_vars
    	 * [{"var":"$userinfo","type":"array","desc":"Submitted User Data"},
    	 * {"var":"$user_id","type":"int","desc":"User ID"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage add_action( 'um_user_pre_updating_profile', 'function_name', 10, 2 );
    	 * @example
    	 * <?php
    	 * add_action( 'um_user_pre_updating_profile', 'my_user_pre_updating_profile', 10, 2 );
    	 * function my_user_pre_updating_profile( $userinfo, $user_id ) {
    	 *     // your code here
    	 * }
    	 * ?>
    	 */
    	do_action( 'um_user_pre_updating_profile', $to_update, $user_id );
    Thread Starter ftballguy45

    (@ftballguy45)

    how do I read them from the UM cache?

    Thread Starter ftballguy45

    (@ftballguy45)

    @missveronicatv thank you
    is there a way to get all the user’s UM fields (including custom fields that we have added)? I would think there’s a way, I just dont know how

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @ftballguy45

    You can try the following Code Snippet to retrieve fields from a specific Profile Form:

    UM()->fields()->set_id = 123;
    $form_fields = UM()->fields()->get_fields();
    

    Regards,

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

The topic ‘How to detect changed fields on profile update’ is closed to new replies.