本文整理汇总了PHP中wp_dropdown_users函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_dropdown_users函数的具体用法?PHP wp_dropdown_users怎么用?PHP wp_dropdown_users使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_dropdown_users函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: soj_manage_posts_by_author
function soj_manage_posts_by_author()
{
global $user_ID;
//echo('<label>Owners</label>');
$editable_ids = get_editable_user_ids($user_ID);
wp_dropdown_users(array('include' => $editable_ids, 'show_option_all' => __('View all Owners'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0));
}
示例2: widget_user_profile_control
/**
* Manage user profile widget.
*/
function widget_user_profile_control()
{
$options = get_option('widget_user_profile');
if (!is_array($options)) {
$options = array('title' => 'User Profile', 'user' => false);
}
if ($_POST['profile_submit']) {
$options['title'] = strip_tags(stripslashes($_POST['profile_title']));
$options['user'] = strip_tags(stripslashes($_POST['profile_user']));
update_option('widget_user_profile', $options);
}
$title = htmlspecialchars($options['title'], ENT_QUOTES);
?>
<p style="text-align:right;">
<label for="profile_title">Title:</label><br />
<input style="width: 200px;" id="profile_title" name="profile_title" type="text" value="<?php
echo $title;
?>
" />
</p>
<p style="text-align:right;"><label for="profile_user">User:</label><br />
<?php
wp_dropdown_users(array('selected' => $options['user'], 'name' => 'profile_user'));
?>
</p>
<style type="text/css"> #profile_user { width: 200px; } </style>
<input type="hidden" id="profile_submit" name="profile_submit" value="1" />
<?php
}
示例3: form
/**
* Back-end widget form.
*/
public function form($instance)
{
$selected_user_id = isset($instance['selected_user_id']) ? $instance['selected_user_id'] : 1;
?>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('selected_user_id'));
?>
"><?php
esc_html_e('Display author:', 'proteuswidgets');
?>
</label>
<?php
wp_dropdown_users(array('name' => $this->get_field_name('selected_user_id'), 'id' => $this->get_field_id('selected_user_id'), 'selected' => $selected_user_id, 'class' => 'widefat'));
?>
</p>
<p><small><?php
printf(esc_html__('To add the social icons to this widget, please install the %sExtra User Details%s plugin and fill in the details in the "Users" section.', 'proteuswidgets'), '<a href="https://wordpress.org/plugins/extra-user-details/" target="_blank">', '</a>');
?>
</small></p>
<?php
}
示例4: display_order_customer_informations
function display_order_customer_informations()
{
global $post_id;
global $wpdb;
$output = '';
if (!empty($post_id)) {
$order_postmeta = get_post_meta($post_id, '_order_postmeta', true);
$order_info = get_post_meta($post_id, '_order_info', true);
/** Check the order status **/
if (!empty($order_postmeta)) {
if (!empty($order_postmeta['order_status']) && $order_postmeta['order_status'] != 'awaiting_payment') {
$output = wps_address::display_an_address($order_info['billing']['address']);
$output .= wps_address::display_an_address($order_info['shipping']['address']);
} else {
$output = wps_address::display_an_address($order_info['billing']['address']);
}
}
} else {
/** Display "Choose customer or create one" Interface **/
$tpl_component = array();
$args = array('show_option_all' => __('Choose a customer', 'wpshop'), 'orderby' => 'display_name', 'order' => 'ASC', 'include' => null, 'exclude' => null, 'multi' => false, 'show' => 'display_name', 'echo' => false, 'selected' => false, 'include_selected' => false, 'name' => 'user', 'id' => null, 'class' => 'chosen_select', 'blog_id' => $GLOBALS['blog_id'], 'who' => null);
$tpl_component['CUSTOMERS_LIST'] = wp_dropdown_users($args);
$output = wpshop_display::display_template_element('wps_orders_choose_customer_interface', $tpl_component, array(), 'admin');
}
return $output;
}
示例5: author_filter
function author_filter()
{
$args = array('name' => 'author', 'show_option_all' => 'View all authors');
if (isset($_GET['user'])) {
$args['selected'] = $_GET['user'];
}
wp_dropdown_users($args);
}
示例6: render
/**
* Render Meta Box content.
*
* @param \WP_Post $post The post object.
*/
function render($post)
{
// Add an nonce field so we can check for it later.
wp_nonce_field($this->nonce_validator->get_action(), $this->nonce_validator->get_name());
$contact_person_id = get_post_meta($post->ID, '_contact_person_id', true);
echo '<label class="screen-reader-text" for="contact_person_id">' . esc_html__('Contact Person', 'contact-person-meta-box') . '</label>';
wp_dropdown_users(array('name' => 'contact_person_id', 'selected' => $contact_person_id, 'include_selected' => true, 'show_option_none' => __('— Select —')));
}
示例7: output
/**
* Output the metabox
*/
public static function output($post)
{
global $post, $wpdb, $thepostid;
$parent_post = false;
if (isset($_GET['post_parent']) && $_GET['post_parent'] != '') {
$parent_post = $_GET['post_parent'];
}
echo '<div class="propertyhive_meta_box">';
echo '<div class="options_group">';
// Negotiator
$negotiator_id = get_post_meta($post->ID, '_negotiator_id', TRUE);
if ($parent_post !== FALSE) {
$negotiator_id = get_post_meta($parent_post, '_negotiator_id', TRUE);
}
if ($negotiator_id == '') {
// if neg isn't set then default to current user
$negotiator_id = get_current_user_id();
}
echo '<p class="form-field negotiator_field">
<label for="_negotiator_id">' . __('Negotiator', 'propertyhive') . '</label>';
$args = array('name' => '_negotiator_id', 'id' => '_negotiator_id', 'class' => 'select short', 'selected' => $negotiator_id);
wp_dropdown_users($args);
echo '
</p>';
$office_id = get_post_meta($post->ID, '_office_id', TRUE);
if ($parent_post !== FALSE) {
$office_id = get_post_meta($parent_post, '_office_id', TRUE);
}
if ($office_id == '') {
// TO DO: Get primary office
}
echo '<p class="form-field negotiator_field">
<label for="_office_id">' . __('Office', 'propertyhive') . '</label>
<select id="_office_id" name="_office_id" class="select short">';
$args = array('post_type' => 'office', 'nopaging' => true, 'orderby' => 'title', 'order' => 'ASC');
$office_query = new WP_Query($args);
if ($office_query->have_posts()) {
while ($office_query->have_posts()) {
$office_query->the_post();
echo '<option value="' . $post->ID . '"';
if ($post->ID == $office_id) {
echo ' selected';
}
echo '>' . get_the_title() . '</option>';
}
}
$office_query->reset_postdata();
echo '</select>
</p>';
do_action('propertyhive_property_record_details_fields');
echo '</div>';
echo '</div>';
}
示例8: _output
function _output($value)
{
$this->args['name'] = 'cuztom' . $this->pre . '[' . $this->id . ']' . $this->after . ($this->repeatable ? '[]' : '');
$this->args['id'] = $this->id . $this->after_id;
$this->args['selected'] = !empty($value) ? $value : $this->default_value;
$this->dropdown = wp_dropdown_users($this->args);
$output = $this->dropdown;
$output .= $this->output_explanation();
return $output;
}
示例9: _replyToAddAuthorTableFilter
public function _replyToAddAuthorTableFilter()
{
if (!$this->oProp->bEnableAuthorTableFileter) {
return;
}
if (!(isset($_GET['post_type']) && post_type_exists($_GET['post_type']) && in_array(strtolower($_GET['post_type']), array($this->oProp->sPostType)))) {
return;
}
wp_dropdown_users(array('show_option_all' => $this->oMsg->get('show_all_authors'), 'show_option_none' => false, 'name' => 'author', 'selected' => !empty($_GET['author']) ? $_GET['author'] : 0, 'include_selected' => false));
}
示例10: output
/**
* Output the metabox
*/
public static function output($post)
{
global $post, $wpdb, $thepostid;
$enquiry_post = $post;
wp_nonce_field('propertyhive_save_data', 'propertyhive_meta_nonce');
echo '<div class="propertyhive_meta_box">';
echo '<div class="options_group">';
$args = array('id' => '_status', 'label' => __('Status', 'propertyhive'), 'desc_tip' => false, 'options' => array('open' => __('Open', 'propertyhive'), 'closed' => __('Closed', 'propertyhive')));
propertyhive_wp_select($args);
// Negotiator
$negotiator_id = get_post_meta($post->ID, '_negotiator_id', TRUE);
echo '<p class="form-field negotiator_id_field">
<label for="_negotiator_id">' . __('Negotiator', 'propertyhive') . '</label>';
$args = array('show_option_none' => '-- ' . __('Unassigned', 'propertyhive') . ' --', 'name' => '_negotiator_id', 'id' => '_negotiator_id', 'class' => 'select short', 'selected' => $negotiator_id);
wp_dropdown_users($args);
echo '
</p>';
$office_id = get_post_meta($post->ID, '_office_id', TRUE);
if ($office_id == '') {
// if neg isn't set then default to current users offices
//$negotiator_id = get_current_user_id();
}
echo '<p class="form-field office_id_field">
<label for="office_id">' . __('Office', 'propertyhive') . '</label>
<select id="_office_id" name="_office_id" class="select short">';
$args = array('post_type' => 'office', 'nopaging' => true, 'orderby' => 'title', 'order' => 'ASC');
$office_query = new WP_Query($args);
if ($office_query->have_posts()) {
while ($office_query->have_posts()) {
$office_query->the_post();
echo '<option value="' . $post->ID . '"';
if ($post->ID == $office_id) {
echo ' selected';
}
echo '>' . get_the_title() . '</option>';
}
}
wp_reset_postdata();
$post = $enquiry_post;
echo '</select>
</p>';
$args = array('id' => '_source', 'label' => __('Source', 'propertyhive'), 'desc_tip' => false, 'options' => array('office' => __('Office', 'propertyhive'), 'website' => __('Website', 'propertyhive')));
propertyhive_wp_select($args);
do_action('propertyhive_enquiry_record_details_fields');
echo '</div>';
echo '</div>';
}
示例11: wp_dropdown_users
/**
* filter wp dropdown users function
*/
public function wp_dropdown_users($output)
{
global $user_ID;
$post = false;
if (isset($_REQUEST['post'])) {
$post_id = $_REQUEST['post'];
$post = get_post($post_id);
}
/**
* remove filter to prevent loop
*/
remove_filter('wp_dropdown_users', array($this, 'wp_dropdown_users'));
$output = wp_dropdown_users(array('who' => '', 'name' => 'post_author_override', 'selected' => $post && isset($post->ID) ? $post->post_author : $user_ID, 'include_selected' => true, 'echo' => false));
return $output;
}
示例12: add_author_filter_to_posts_administration
function add_author_filter_to_posts_administration()
{
//execute only on the 'post' content type
global $post_type;
if ($post_type == 'meal') {
//get a listing of all users that are 'author' or above
$user_args = array('show_option_all' => 'All Users', 'orderby' => 'display_name', 'order' => 'ASC', 'name' => 'aurthor_admin_filter', 'who' => 'authors', 'include_selected' => true);
//determine if we have selected a user to be filtered by already
if (isset($_GET['aurthor_admin_filter'])) {
//set the selected value to the value of the author
$user_args['selected'] = (int) sanitize_text_field($_GET['aurthor_admin_filter']);
}
//display the users as a drop down
wp_dropdown_users($user_args);
}
}
示例13: theme_post_author_override
function theme_post_author_override($output)
{
global $post;
// return if this isn't the theme author override dropdown
if (!preg_match('/post_author_override/', $output)) {
return $output;
}
// return if we've already replaced the list (end recursion)
if (preg_match('/post_author_override_replaced/', $output)) {
return $output;
}
// replacement call to wp_dropdown_users
$output = wp_dropdown_users(array('echo' => 0, 'name' => 'post_author_override_replaced', 'selected' => empty($post->ID) ? $user_ID : $post->post_author, 'include_selected' => true));
// put the original name back
$output = preg_replace('/post_author_override_replaced/', 'post_author_override', $output);
return $output;
}
示例14: epl_custom_restrict_manage_posts
function epl_custom_restrict_manage_posts()
{
global $post_type;
if ($post_type == 'property' || $post_type == 'rental' || $post_type == 'land' || $post_type == 'commercial' || $post_type == 'rural' || $post_type == 'business' || $post_type == 'holiday_rental' || $post_type == 'commercial_land') {
//Filter by property_status
$fields = array('current' => __('Current', 'epl'), 'withdrawn' => __('Withdrawn', 'epl'), 'offmarket' => __('Off Market', 'epl'));
if ($post_type != 'rental' && $post_type != 'holiday_rental') {
$fields['sold'] = apply_filters('epl_sold_label_status_filter', __('Sold', 'epl'));
}
if ($post_type == 'rental' || $post_type == 'holiday_rental' || $post_type == 'commercial' || $post_type == 'business' || $post_type == 'commercial_land') {
$fields['leased'] = apply_filters('epl_leased_label_status_filter', __('Leased', 'epl'));
}
if (!empty($fields)) {
$_GET['property_status'] = isset($_GET['property_status']) ? sanitize_text_field($_GET['property_status']) : '';
echo '<select name="property_status">';
echo '<option value="">' . __('Filter By Type', 'epl') . '</option>';
foreach ($fields as $k => $v) {
$selected = $_GET['property_status'] == $k ? 'selected="selected"' : '';
echo '<option value="' . $k . '" ' . $selected . '>' . __($v, 'epl') . '</option>';
}
echo '</select>';
}
$property_author = isset($_GET['property_author']) ? intval($_GET['property_author']) : '';
// filter by authors
wp_dropdown_users(array('name' => 'property_author', 'selected' => $property_author, 'show_option_all' => __('All Users', 'epl')));
$custom_search_fields = array('property_address_suburb' => epl_labels('label_suburb'), 'property_office_id' => __('Office ID', 'epl'), 'property_agent' => __('Listing Agent', 'epl'), 'property_second_agent' => __('Second Listing Agent', 'epl'));
$custom_search_fields = apply_filters('epl_admin_search_fields', $custom_search_fields);
if (!empty($custom_search_fields)) {
$_GET['property_custom_fields'] = isset($_GET['property_custom_fields']) ? sanitize_text_field($_GET['property_custom_fields']) : '';
echo '<select name="property_custom_fields">';
echo '<option value="">' . __('Search For :', 'epl') . '</option>';
foreach ($custom_search_fields as $k => $v) {
$selected = $_GET['property_custom_fields'] == $k ? 'selected="selected"' : '';
echo '<option value="' . $k . '" ' . $selected . '>' . __($v, 'epl') . '</option>';
}
echo '</select>';
}
//Filter by Suburb
if (isset($_GET['property_custom_value'])) {
$val = stripslashes($_GET['property_custom_value']);
} else {
$val = '';
}
echo '<input type="text" name="property_custom_value" placeholder="' . __('Search Value.', 'epl') . '" value="' . $val . '" />';
}
}
示例15: view
function view()
{
global $wpdb;
echo '<h2>' . __("User Files", "sp-cdm") . '</h2>' . sp_client_upload_nav_menu() . '' . __("Choose a user below to view their files", "sp-cdm") . '<p>
<div style="margin-top:20px;margin-bottom:20px">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#user_uid").change(function() {
jQuery.cookie("pid", 0, { expires: 7 , path:"/" });
window.location = "admin.php?page=sp-client-document-manager-fileview&id=" + jQuery("#user_uid").val();
})
});
</script>
<form>';
wp_dropdown_users(array('name' => 'user_uid', 'show_option_none' => 'Choose a user', 'selected' => $_GET['id']));
echo '</form></div>';
if ($_GET['id'] != '') {
echo do_shortcode('[sp-client-document-manager uid="' . $_GET['id'] . '"]');
}
}