Cannot see created field in my Booking form page (From custom hook)
-
I want to create a simple custom field for the register form called “Company”. The company I work for doesn’t have much money to use toward web applications, so we are trying to with do with much we can. I do love the Events Manager plugin very much. I have created some hooks to add a custom field to the register form directly from the admin. The text field shows up in the form just nicely, and was able to custom in the admin. It almost seems to work but in admin area I drag & drop the new created field which I called “Company” into table and this works as well. BUT I can not see this new created field’s content in my Booking form page.
function bweb_add_custom_event_fields(){ ?> <p> <label for='user_company'><?php esc_html_e('Company', 'textdomain'); ?></label> <input type="text" name="user_company" id="user-company" class="input" value="<?php if(!empty($_REQUEST['user_company'])) echo esc_attr($_REQUEST['user_company']); ?>" /> </p> <?php } add_action('em_register_form','bweb_add_custom_event_fields'); function bweb_save_custom_event_fields (){ global $EM_Booking ; if( ! empty( $_REQUEST['user_company'] ) ){ $EM_Booking->booking_meta['registration']['user_company'] = wp_kses( $_REQUEST['user_company'], array() ); } } add_filter('em_booking_add','bweb_save_custom_event_fields'); function bweb_table_custom_event_fields($template, $EM_Bookings_Table){ $template['user_company'] = __('Company', 'textdomain'); return $template; } add_action('em_bookings_table_cols_template', 'bweb_table_custom_event_fields',10,2); function bweb_display_col_custom_event_fields($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){ if( $col == 'user_company' ){ $val = $EM_Booking->get_person()->user_company; } return $val; } add_filter('em_bookings_table_rows_col','bweb_display_col_custom_event_fields', 10, 5);
I am trying to figure why the contents is not showing up in the admin. Can you help on why and give me some advice to fix?
- The topic ‘Cannot see created field in my Booking form page (From custom hook)’ is closed to new replies.