Title: user profile &#8211; front end
Last modified: August 24, 2016

---

# user profile – front end

 *  Resolved [andp](https://wordpress.org/support/users/andp/)
 * (@andp)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/)
 * can i make repeatable group fields for user profile? is there a way to display
   them on the front end so that a user can edit/update them without accessing the
   back-end
 * thank u
 * [https://wordpress.org/plugins/cmb2/](https://wordpress.org/plugins/cmb2/)

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

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969228)
 * If it’s a field that’s able to be repeatable, then it’ll be true regardless of
   where the metabox contents are output. You are also able to have the user metaboxes
   output on the frontend and update user meta data from the frontend, it just may
   take some tinkering and reviewing of examples to get it working perfectly. We
   don’t always have code snippets available for every use case.
 *  Thread Starter [andp](https://wordpress.org/support/users/andp/)
 * (@andp)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969302)
 * Hello Michael and thanks for your quick reply on my previous question.
 * So far i managed to create the desired custom user fields (repeatable, rebeatable
   boxes) on the back-end and they are working OK.
 * I also found a useful post about how to use cmb2 fields in the front-end ([http://webdevstudios.com/2015/03/30/use-cmb2-to-create-a-new-post-submission-form/](http://webdevstudios.com/2015/03/30/use-cmb2-to-create-a-new-post-submission-form/)).
 * I am struggling though of how to use my custom user fields on the front-end. 
   My purpose is not only to display them but to make them editable.
 * I would appreciate any kind of help or hint on this.
 * Thank u
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969304)
 * [This snippet](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-metabox-shortcode.php)
   is for displaying/editing fields on the front-end. It works by adding a shortcode,
   but hopefully you can see how it works. You would just substitute the post id
   with the user id.
 *  Thread Starter [andp](https://wordpress.org/support/users/andp/)
 * (@andp)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969319)
 * hello again
 * i am using your given examples but i cant get it right.
 * add_action( ‘cmb2_init’, ‘yourprefix_register_user_profile_metabox’ );
    function
   yourprefix_register_user_profile_metabox() {
 *  // Start with an underscore to hide fields from custom fields list
    $prefix 
   = ‘_yourprefix_user_’;
 *  /**
    * Metabox for the user profile screen */ $cmb_user = new_cmb2_box( array(‘
   id’ => $prefix . ‘edit’, ‘title’ => __( ‘User Profile Metabox’, ‘cmb2’ ), ‘object_types’
   => array( ‘user’ ), // Tells CMB to use user_meta vs post_meta ‘show_names’ =
   > true, ‘new_user_section’ => ‘add-new-user’, // where form will show on new 
   user page. ‘add-existing-user’ is only other valid option. ) );
 *  $cmb_user->add_field( array(
    ‘name’ => __( ‘Extra Info’, ‘cmb2’ ), ‘desc’ =
   > __( ‘field description (optional)’, ‘cmb2’ ), ‘id’ => $prefix . ‘extra_info’,‘
   type’ => ‘title’, ‘on_front’ => false, ) );
 *  $cmb_user->add_field( array(
    ‘name’ => __( ‘Something’, ‘cmb2’ ), ‘desc’ =>
   __( ‘field description (optional)’, ‘cmb2’ ), ‘id’ => $prefix . ‘something’, ‘
   type’ => ‘textarea’, ) );}
 * function jt_cmb2_do_frontend_form_shortcode( $atts = array() ) {
    global $post;/***
   Make sure a WordPress post ID is set. * We’ll default to the current post/page*/
   if ( ! isset( $atts[‘user_id’] ) ) { $atts[‘user_id’] = $post->ID; } // If no
   metabox id is set, yell about it if ( empty( $atts[‘id’] ) ) { return ‘Please
   add an “id” attribute to specify the CMB2 form to display.’; } $metabox_id = 
   esc_attr( $atts[‘id’] ); $object_id = absint( $atts[‘user_id’] ); // Get our 
   form $form = cmb2_get_metabox_form( $metabox_id, $object_id ); return $form; }
   add_shortcode( ‘cmb-form’, ‘jt_cmb2_do_frontend_form_shortcode’ );
 * /*shortcode [cmb-form id=”edit” user_id=1]*/
 *  Thread Starter [andp](https://wordpress.org/support/users/andp/)
 * (@andp)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969320)
 * Hello i figured it out
 * thank again for your help
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969323)
 * Awesome to hear, andp.
 *  [onebob](https://wordpress.org/support/users/onebob/)
 * (@onebob)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969377)
 * Hi andp
    Is there any chance that you could post what you figured out? Many thanks
   Onebob
 *  [elisafern](https://wordpress.org/support/users/elisafern/)
 * (@elisafern)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969405)
 * Same here, I would appreciate it 🙂
 * Thanks!
 *  [elisafern](https://wordpress.org/support/users/elisafern/)
 * (@elisafern)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969406)
 * Got it!
 * Just need to correct the $post->ID by $user->ID and also add your prefix to the
   shortcode for the id attribute, like:
 * [cmb-form id=”_yourprefix_user_edit” user_id=1]
 * Thanks!

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

The topic ‘user profile – front end’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 9 replies
 * 5 participants
 * Last reply from: [elisafern](https://wordpress.org/support/users/elisafern/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/user-profile-front-end/#post-5969406)
 * Status: resolved