• Resolved Tim Burkart

    (@bigmoxy)


    I’m trying to write a hook but the $changes array appears to be empty. Is it my code or is there a problem with the hook? The $user_id is present but nothing for $changes.

    add_action( ‘um_after_user_account_updated’, ‘ikorcc_after_user_account_updated’, 10, 2);

    function ikorcc_after_user_account_updated( $user_id, $changes ){
    ob_start();

    echo "User ID: " . $user_id . "\nChanges:\n";
    foreach($changes as $key => $data) {
        echo $key . ': ' . (is_array($data) ? print_r($data, true) : $data) . "\n";
    }
    
    $contents = ob_get_contents();
    ob_end_clean();
    
    $admin_email = UM()->options()->get( 'admin_email' );
    wp_mail( $admin_email,'User Account Updated', $contents );

    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support andrewshu

    (@andrewshu)

    Hello @bigmoxy

    I think you code is wrong. Also, you could change the hook priority = 10 (try different).

    Regards.

    Plugin Support andrewshu

    (@andrewshu)

    Hi @bigmoxy

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘$changes array is empty’ is closed to new replies.