Custom Fields
Support MB User Profile user_id attribute in mb_user_profile_info shortcode

This topic contains 3 replies, has 2 voices, and was last updated by  streamlinerr 6 months, 2 weeks ago.

  • Creator
  • #14445


    I’m trying to display a frontend form for user profile info editing (not for current user), as per documentation ( 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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #14446


    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.


    Anh Tran


    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?



    Yes, I need to let admins edit user profiles.

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

You must be logged in to reply to this topic.