This commit is contained in:
Mykyta Synelnikov
2023-07-24 22:57:49 +03:00
parent 563ed8c21e
commit 15a18cf6d4
+6 -7
View File
@@ -1062,7 +1062,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
do_action( 'um_admin_custom_login_metaboxes' ); do_action( 'um_admin_custom_login_metaboxes' );
} }
/** /**
* Save directory metabox * Save directory metabox
* *
@@ -1089,11 +1088,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
return; return;
} }
$where = array( 'ID' => $post_id );
if ( empty( $_POST['post_title'] ) ) { if ( empty( $_POST['post_title'] ) ) {
$where = array( 'ID' => $post_id );
// translators: %s: Directory id. // translators: %s: Directory id.
$_POST['post_title'] = sprintf( __( 'Directory #%s', 'ultimate-member' ), $post_id ); $_POST['post_title'] = sprintf( __( 'Directory #%s', 'ultimate-member' ), $post_id );
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) ), $where );
} }
do_action( 'um_before_member_directory_save', $post_id ); do_action( 'um_before_member_directory_save', $post_id );
@@ -1156,14 +1155,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
update_post_meta( $post_id, '_um_search_filters_gmt', (int) $_POST['um-gmt-offset'] ); update_post_meta( $post_id, '_um_search_filters_gmt', (int) $_POST['um-gmt-offset'] );
} }
/** /**
* Save form metabox * Save form metabox
* *
* @param $post_id * @param $post_id
* @param $post * @param $post
*/ */
function save_metabox_form( $post_id, $post ) { public function save_metabox_form( $post_id, $post ) {
global $wpdb; global $wpdb;
// validate nonce // validate nonce
@@ -1173,7 +1171,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
} }
// validate post type // validate post type
if ( $post->post_type != 'um_form' ) { if ( 'um_form' !== $post->post_type ) {
return; return;
} }
@@ -1183,10 +1181,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
return; return;
} }
$where = array( 'ID' => $post_id );
if ( empty( $_POST['post_title'] ) ) { if ( empty( $_POST['post_title'] ) ) {
$where = array( 'ID' => $post_id );
// translators: %s: Form id. // translators: %s: Form id.
$_POST['post_title'] = sprintf( __( 'Form #%s', 'ultimate-member' ), $post_id ); $_POST['post_title'] = sprintf( __( 'Form #%s', 'ultimate-member' ), $post_id );
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) ), $where );
} }
// save // save