'office', 'nopaging' => true, 'orderby' => 'post_title', 'order' => 'ASC', ); $offices = array(); $offices_query = new WP_Query( $args ); if ( $offices_query->have_posts() ) { while ( $offices_query->have_posts() ) { $offices_query->the_post(); $offices[get_the_ID()] = get_the_title(); } } wp_reset_postdata(); $fields = array( 'office_id' => array( 'label' => __( 'Office', 'propertyhive' ), 'description' => '', 'type' => 'select', 'options' => array( '' => __( 'Select an office', 'propertyhive' ) ) + $offices, ), 'telephone_number' => array( 'label' => __( 'Telephone Number', 'propertyhive' ), 'description' => '', 'type' => 'text', ), 'photo_attachment_id' => array( 'label' => __( 'Photo', 'propertyhive' ), 'description' => '', 'type' => 'image', ), ); $user = wp_get_current_user(); $roles = (array)$user->roles; $fields['crm_only_mode'] = array( 'label' => __( 'Property Hive-Only Mode', 'propertyhive' ), 'description' => __( 'Enabling this option will remove all top level WordPress menu items leaving just Property Hive options making it easier to navigate and use as a CRM', 'propertyhive' ), 'type' => in_array('administrator', $roles) ? 'checkbox' : 'hidden', ); $show_fields = array( 'negotiator' => array( 'title' => __( 'Property Hive Negotiator Details', 'propertyhive' ), 'fields' => $fields, ), ); $show_fields = apply_filters( 'propertyhive_user_meta_fields', $show_fields ); return $show_fields; } /** * Show fields on edit user pages. * * @param WP_User $user */ public function extra_user_meta_fields( $user ) { if ( ! current_user_can( 'manage_propertyhive' ) ) { return; } $user_meta = get_userdata($user->ID); $user_roles = $user_meta->roles; if ( ! in_array("administrator", $user_roles) && ! in_array("editor", $user_roles) ) { return; } $show_fields = $this->get_user_meta_fields(); foreach ( $show_fields as $fieldset_key => $fieldset ) : ?>
| ID, $key, true ), 1, true ); ?> /> |