user_id attribute in mb_user_profile_info shortcode

Support MB User Profile user_id attribute in mb_user_profile_info shortcode

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14445
    streamlinerrstreamlinerr
    Participant

    I'm trying to display a frontend form for user profile info editing (not for current user), as per documentation (https://docs.metabox.io/extensions/mb-user-profile/). However, even after setting user_id, this attribute does nothing, it always displays form only with current users' data.

    my code:

    $form = '[mb_user_profile_info id="user-data" user_id="' . $user_id . '" submit_button="Submit" confirmation="Your information has been successfully submitted. Thank you."]';
    echo do_shortcode( $form );

    where $user_id has value.

    Why is this not working?

    #14446
    streamlinerrstreamlinerr
    Participant

    After some exploration, I noticed that user_id attribute is not listed in shortcode_atts in MB_User_Profile_Shortcode_Info class. If I add 'user_id' => '' to $args array, and modify $meta_box->set_object_id( get_current_user_id() ); to $meta_box->set_object_id( !empty($args['user_id']) ? $args['user_id'] : get_current_user_id() ); I can retrieve data from specified user_id. However, form is still submitted for current_user, not specified user.

    #14452
    Anh TranAnh Tran
    Keymaster

    Hi,

    In the latest version, we decided to removed the user_id attribute from the shortcode, to fix a security bug. With that, only the current user can edit his or her profile. Are you trying to let admins edit user profile?

    #14462
    streamlinerrstreamlinerr
    Participant

    Yes, I need to let admins edit user profiles.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.