Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@webdevs-pro
Last active January 6, 2020 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdevs-pro/548643394478b3d6fa8b4147736884ef to your computer and use it in GitHub Desktop.
Save webdevs-pro/548643394478b3d6fa8b4147736884ef to your computer and use it in GitHub Desktop.
view&update custom fields in the [ultimatemember_account] page
<?php
add_action('um_after_account_general', 'showUMExtraFields', 100);
function showUMExtraFields() {
$id = um_user('ID');
$output = '';
$names = array('birth_date');
$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 );
}
echo $output;
}
add_action('um_account_pre_update_profile', 'getUMFormData', 100);
function getUMFormData(){
$id = um_user('ID');
$names = array('birth_date');
foreach( $names as $name ) {
update_user_meta( $id, $name, $_POST[$name] );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment