• Resolved lbwbx

    (@lbwbx)


    When a create a custom user field (type url) from the profile form with the meta key “aml_test_results”, then edit the users field in the profile page – I can see it updates the users meta to that same value when calling the following in php:
    echo get_user_meta(get_current_user_id(), 'aml_test_results', true);
    or
    echo um_user('aml_test_results');

    but after updating the meta in php for example:
    `update_user_meta( get_current_user_id(), ‘aml_test_results’, “newvalue” );

    then
    echo get_user_meta(get_current_user_id(), 'aml_test_results', true);
    shows “newvalue”
    while
    echo um_user('aml_test_results');
    shows the old value and the value is not updated in the user profile.

    How can I update the value in the user profile with php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @lbwbx

    You need to clear the user cache after updating the user meta.

    Here’s the code to clear the user cache:

    $user_id = get_current_user_id();
    update_user_meta( $user_id, ‘aml_test_results’, “newvalue” )
    UM()->user()->remove_cache( $user_id );
    Thread Starter lbwbx

    (@lbwbx)

    Thank you that works!

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @lbwbx

    Thanks for letting us know.

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

The topic ‘Change User FIelds Data With Php’ is closed to new replies.