Problem on saving fields in Custom Account Tab
-
Hi,
I’m trying to create a custom account tab with custom fields on it, doing it this way :
1) I’ve created new fields inside an unused UM Form
2) I’ve hooked the needed actions like this :add_filter('um_account_page_default_tabs_hook', 'test_custom_tabs_in_um', 100 ); function test_custom_tabs_in_um($tabs) { $tabs[00]['myteststats'] = array('icon' => 'um-icon-ios-analytics', 'title' => 'Statistics', 'custom' => true, 'show_button' => true); return $tabs; } add_action('um_account_tab__ myteststats', 'um_account_tab__ myteststats'); function um_account_tab__ myteststats( $info ) { global $ultimatemember; extract( $info ); $output = $ultimatemember->account->get_tab_output('myteststats'); if ( $output ) { echo $output; } } add_filter('um_account_content_hook_ myteststats', 'um_account_content_hook_ myteststats'); function um_account_content_hook_ myteststats( $output ){ ob_start(); ?> <div class="um-field"> <!-- Here goes your custom content --> <?php global $ultimatemember; $id = um_user('ID'); $names = [ 'pilot_total_hours','pilot_hours_cdb','pilot_hours_cdb_last_year','pilot_hours_cdb_3months','pilot_hours_since_ppl']; $fields = []; foreach($names as $name) $fields[$name] = UM()->builtin()->get_specific_field($name); $fields = apply_filters('um_account_secure_fields', $fields, get_current_user_id()); foreach( $fields as $key => $data ) $output2 .= UM()->fields()->edit_field( $key, $data ); echo str_ireplace("\\", "", $output2); ?> </div> <?php $output .= ob_get_contents(); ob_end_clean(); return $output; }
At this point, the form is properly showing the fields, in editing mode.
But when I click on save, there’s no saving indeed. Values stays blank…
What is missing ?Also, what is the PHP function to save values in um_user that can be retrieve by um_user(‘nameOfField’) ?
Thanks a lot
- The topic ‘Problem on saving fields in Custom Account Tab’ is closed to new replies.