Don’t submit value after update
-
Hi,
I’m using ultimate member for years, I created a custom tab in Edit Profile to update a value. In fact my users (students) can edit (add or remove) their pre-registered courses. The problem is that when they try to add or remove course, an error occurs, “An error has encountered”. Surprisingly, they can remove the course even though it shows an error, but they can’t add any course. It was working flawlessly till the latest update of Ultimate member. The code is as follows:
* */ /* create new tab */ add_filter('um_account_page_default_tabs_hook', 'CoursesTab', 100 ); function CoursesTab( $tabs ) { $tabs[800]['CoursesTab']['icon'] = 'um-faicon-pencil'; // tab icon $tabs[800]['CoursesTab']['title'] = 'Registered Courses'; // tab title $tabs[800]['CoursesTab']['submit_title'] = 'Update'; // button text $tabs[800]['CoursesTab']['custom'] = true; return $tabs; } /* make our new tab hookable */ add_action('um_account_tab__CoursesTab', 'um_account_tab__CoursesTab'); function um_account_tab__CoursesTab( $info ) { extract( $info ); $output = UM()->account->get_tab_output('CoursesTab'); if ( $output ) { echo $output; } } /* Finally we add some content in the tab */ add_filter('um_account_content_hook_CoursesTab', 'um_account_content_hook_CoursesTab'); function um_account_content_hook_CoursesTab( $output ){ ob_start(); $id = um_user('ID'); $output = '<div class="um-field">'; $names = array('course','course'); $fields = array(); foreach( $names as $name ){ $fields[ $name ] = UM()->builtin()->get_specific_field( $name ); } $fields = apply_filters('um_account_secure_fields', $fields, $id); foreach( $fields as $key => $data ){ $output .= UM()->fields()->edit_field( $key, $data ); } $output .= '</div>'; $output .= ob_get_contents(); ob_end_clean(); return $output; } /* ensure that the custom fields are updated when the account is updated */ add_action('um_account_pre_update_profile', 'getUMFormData', 100); function getUMFormData(){ $id = um_user('ID'); $names = array('course','course'); // ADD THE META-KEYS HERE foreach( $names as $name ) update_user_meta( $id, $name, $_POST[$name] ); }
I searched a lot, however, found no clue how to solve the issue.
Thank youThe page I need help with: [log in to see the link]
- The topic ‘Don’t submit value after update’ is closed to new replies.