• Resolved mychildren2020

    (@mychildren2020)


    Dear Support Team,

    How to identify the changes made during update profile in the hooks um_before_update_profile & um_after_user_updated? There is an array $changes, but it holds many fields which haven’t been changed. Which fields it is supposed to hold?

    To identify whether a field is modified, we tried to compare database value with value in $changes. We are able to identify if a new value is coming for a particular field in um_before_update_profile. But, that is not possible in um_after_user_updated since database value is same as new value.

    Now we need to update last modification date field ( say 2nd field) based on change of a particular field (say 1st field) by the user at front-end. We tried to do that by

    if (1st field in $change != 1st field in database)
    {
    update_user_meta($user_id, ‘last_support_date’,$current_date); in um_before_update_profile.
    }

    But, for some reason, it is not updating. Even we tried to change the $change array so that it gets updated later in the process like

    $changes[‘last_support_date’] = $current_date;

    But, if we do update_user_meta($user_id, ‘last_support_date’,$current_date); in um_after_user_updated, it is perfectly updating the user profile. But, unfortunately we can not detect whether user modified the 1st field in um_after_user_updated. We also observed $changes array differs between um_before_update_profile and um_after_user_updated.

    Please let us know the correct way of doing this. If you let us know the php file where you are processing this or how actually it helps, will be also fine.

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

    UM version 2.6.10

    .../plugins/ultimate-member/includes/core/class-user.php
    Line 2153
    $changes = apply_filters( 'um_before_update_profile', $changes, $args['ID'] );

    .../plugins/ultimate-member/includes/core/um-actions-profile.php
    Line 494
    do_action( 'um_after_user_updated', $user_id, $args, $to_update );

    • This reply was modified 1 year, 6 months ago by missveronica.
    Thread Starter mychildren2020

    (@mychildren2020)

    Dear Support,

    Thank you for referring these filter and action hook. But, it doesn’t solve the issue. Please read the scenario carefully and suggest.

    The scenario: There is one field which user needs to update periodically (FIELD1). There is another field (FIELD2) which user doesn’t have access, but we need to programmatically update when FIELD1 is being updated by user from front-end (actually FIELD2 is current date which signifies last update date of FIELD1 by the user).

    Please let us know what is the best way to do that.

    Since user doesn’t have access (view/edit) of FIELD 2, when we are doing update_user_meta($user_id, ‘last_support_date’,$current_date); or $changes[‘last_support_date’] = $current_date; in um_before_update_profile, it is failing.

    But, surprisingly update_user_meta($user_id, ‘last_support_date’,$current_date); in um_after_user_updated is working perfectly.

    Thread Starter mychildren2020

    (@mychildren2020)

    It looks whitelist hook is working.. I will update if I face any issue.. Thanks for your help,

    Plugin Support andrewshu

    (@andrewshu)

    Hi @mychildren2020

    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 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Regarding hooks um_before_update_profile & um_after_user_updated’ is closed to new replies.