mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 14:13:46 +09:00
Fix role field options
This commit is contained in:
+4
-4
@@ -1613,23 +1613,23 @@ class UM_Fields {
|
|||||||
|
|
||||||
// role field
|
// role field
|
||||||
if ( $form_key == 'role' ) {
|
if ( $form_key == 'role' ) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
foreach($options as $key => $val ) {
|
foreach($options as $key => $val ) {
|
||||||
$val = (string) $val;
|
$val = (string) $val;
|
||||||
$val = trim( $val );
|
$val = trim( $val );
|
||||||
$post_id = $wpdb->get_var(
|
$post_id = $wpdb->get_var(
|
||||||
$wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND post_title = %s", $val)
|
$wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND post_name = %s OR post_title = %s", $key, $val )
|
||||||
);
|
);
|
||||||
$_role = get_post( $post_id );
|
$_role = get_post( $post_id );
|
||||||
$new_roles[ $_role->post_name ] = $_role->post_title;
|
if( isset( $_role->post_title ) ){
|
||||||
|
$new_roles[ $_role->post_name ] = $_role->post_title;
|
||||||
|
}
|
||||||
wp_reset_postdata();
|
wp_reset_postdata();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = $new_roles;
|
$options = $new_roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add an empty option!
|
// add an empty option!
|
||||||
$output .= '<option value=""></option>';
|
$output .= '<option value=""></option>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user