noorakhtar
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [CMB2] Multicheck fields sending keys instead of values in database.THANK YOU SO MUCH, MICHAEL. Thank You So Much. Great support you have provided!! The problem is solved!!!
Forum: Plugins
In reply to: [CMB2] Multicheck fields sending keys instead of values in database.Thank you Michael. I understood that. But things I can’t do is that I want to display the checked values in wp_list_table. When I am writing this code to retrieve the value
$tprofile_users = get_users( array( 'role__in' => array( 'subscriber' ) ) ); foreach( $tprofile_users as $tprofile_user ){ global $current_user; $user_id = $current_user->ID; $tprofile_user_cmeta = get_the_author_meta( $user_id ); $data[] = [ 'fighting_style' => esc_html( $tprofile_user->$tprofile_user_cmeta['_user-fighting-style'][0] ), }
Result is showing in this way:a:5:{i:0;s:3:”MMA”;i:1;s:9:”Kikboxing”;i:2;s:6:”Boxing”;i:3;s:4:”Judo”;i:4;s:9:”Taekwondo”;}
Could you please show me how can I display the result in this way : MMA, Kikboxing, Boxing, Judo, Taekwondo
I couldn’t find any solution anywhere. Thank you for taking care my issue.Forum: Plugins
In reply to: [CMB2] Multicheck fields sending keys instead of values in database.add_action( 'cmb2_admin_init', 'tprofile_user_fighting_meta'); function tprofile_user_fighting_meta(){ $tprofile_user_fight_info = new_cmb2_box( array( 'id' => 'fighting-info', 'object_types' => array( 'user' ), 'title' => __( 'Fighting Profile', 'tprofile' ) ) ); $tprofile_user_fight_info->add_field( array( 'id' => '_user-fighting-style', 'name' => __( 'Your fighting styles', 'tprofile' ), 'type' => 'multicheck', 'options' => array( 'MMA' => __('MMA', 'tprofile' ), 'Kikboxing' => __( 'Kikboxing', 'tprofile' ), 'Boxing' => __( 'Boxing', 'tprofile' ), 'Judo' => __( 'Judo', 'tprofile' ), 'Taekwondo' => __( 'Taekwondo', 'tprofile'), 'Karate' => __( 'Karate', 'tprofile' ), 'Brazilian' => __( 'Brazilian Jiu-jitsu', 'tprofile' ), 'Wrestling' => __( 'Wrestling', 'tprofile' ), 'Capoeira' => __( 'Capoeira', 'tprofile' ), 'Muay Thai' => __( 'Muay Thai', 'tprofile' ), 'Karate Kyokushinkai'=> __('Karate Kyokushinkai', 'tprofile' ), 'Kudo Daido Juku' => __('Kudo Daido Juku', 'tprofile' ), ) ) ); }
Values are saving in database in this way: a:3:{i:0;s:3:”MMA”;i:1;s:4:”Judo”;i:2;s:6:”Karate”
Viewing 3 replies - 1 through 3 (of 3 total)