PATH:
home
/
letacommog
/
supportleta
/
wp-content
/
themes
/
easyweb
/
inc
/
meta-box
/
inc
/
fields
<?php /** * User field class. */ class RWMB_User_Field extends RWMB_Object_Choice_Field { /** * Normalize parameters for field * * @param array $field * * @return array */ static function normalize( $field ) { /** * Set default field args */ $field = parent::normalize( $field ); /** * Prevent select tree for user since it's not hierarchical */ $field['field_type'] = 'select_tree' === $field['field_type'] ? 'select' : $field['field_type']; /** * Set to always flat */ $field['flatten'] = true; /** * Set default placeholder */ $field['placeholder'] = empty( $field['placeholder'] ) ? __( 'Select an user', 'meta-box' ) : $field['placeholder']; /** * Set default query args */ $field['query_args'] = wp_parse_args( $field['query_args'], array( 'orderby' => 'display_name', 'order' => 'asc', 'role' => '', 'fields' => 'all', ) ); return $field; } /** * Get users * * @param array $field * * @return array */ static function get_options( $field ) { $options = get_users( $field['query_args'] ); return $options; } /** * Get field names of object to be used by walker * * @return array */ static function get_db_fields() { return array( 'parent' => 'parent', 'id' => 'ID', 'label' => 'display_name', ); } /** * Get option label * * @param string $value Option value * @param array $field Field parameter * * @return string */ static function get_option_label( $value, $field ) { $user = get_userdata( $value ); return '<a href="' . get_author_posts_url( $value ) . '">' . $user->display_name . '</a>'; } }
[+]
..
[-] oembed.php
[edit]
[-] taxonomy-advanced.php
[edit]
[-] email.php
[edit]
[-] autocomplete.php
[edit]
[-] multiple-values.php
[edit]
[-] input-list.php
[edit]
[-] checkbox-list.php
[edit]
[-] button.php
[edit]
[-] object-choice.php
[edit]
[-] image-select.php
[edit]
[-] radio.php
[edit]
[-] fieldset-text.php
[edit]
[-] heading.php
[edit]
[-] hidden.php
[edit]
[-] user.php
[edit]
[-] time.php
[edit]
[-] file-upload.php
[edit]
[-] text-list.php
[edit]
[-] textarea.php
[edit]
[-] url.php
[edit]
[-] key-value.php
[edit]
[-] date.php
[edit]
[-] wysiwyg.php
[edit]
[-] password.php
[edit]
[-] text.php
[edit]
[-] file-advanced.php
[edit]
[-] post.php
[edit]
[-] map.php
[edit]
[-] select-advanced.php
[edit]
[-] plupload-image.php
[edit]
[-] file.php
[edit]
[-] image-upload.php
[edit]
[-] number.php
[edit]
[-] taxonomy.php
[edit]
[-] file-input.php
[edit]
[-] slider.php
[edit]
[-] thickbox-image.php
[edit]
[-] datetime.php
[edit]
[-] divider.php
[edit]
[-] color.php
[edit]
[-] custom-html.php
[edit]
[-] image-advanced.php
[edit]
[-] media.php
[edit]
[-] select-tree.php
[edit]
[-] choice.php
[edit]
[-] input.php
[edit]
[-] range.php
[edit]
[-] select.php
[edit]
[-] switcher.php
[edit]
[-] checkbox.php
[edit]
[-] image.php
[edit]