本文整理汇总了PHP中get_users函数的典型用法代码示例。如果您正苦于以下问题:PHP get_users函数的具体用法?PHP get_users怎么用?PHP get_users使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_users函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: query_members
function query_members()
{
global $wpdb;
$show = isset($attr['show']) ? (int) $attr['show'] : 20;
$orderby = isset($attr['orderby']) ? trim($attr['orderby']) : 'video';
$order = isset($attr['order']) ? trim($attr['order']) : 'DESC';
$user_array = array('number' => $show, 'orderby' => 'post_count', 'order' => 'DESC');
$users = get_users($user_array);
if (!empty($users)) {
foreach ($users as $user) {
$user_data = get_user_by('id', $user->ID);
$content .= '
<div class="channel-header">
<div class="channel-image"><a href="' . get_author_posts_url($user->ID) . '">' . get_avatar($user->ID) . '</a></div>
<div class="channel-info">
<h3>' . $user_data->display_name . '</h3>
<span class="channel-item"><strong>' . __('Videos:', 'mars') . '</strong> ' . mars_get_user_postcount($user->ID) . '</span>
<span class="channel-item"><strong>' . __('Likes:', 'mars') . '</strong> ' . mars_get_user_metacount($user->ID, 'like_key') . '</span>
<span class="channel-item"><strong>' . __('Views:', 'mars') . '</strong> ' . mars_get_user_metacount($user->ID, 'count_viewed') . '</span>
</div>
</div>
';
}
}
return $content;
}
开发者ID:chypriote,项目名称:wp-video,代码行数:29,代码来源:Mars_Members_List.php
示例2: widget
/**
* Outputs the widget based on the arguments input through the widget controls.
*
* @since 0.1.0
*/
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
/* Set up the arguments for get_users(). */
$args = array('role' => $instance['role'], 'meta_key' => $instance['meta_key'], 'meta_value' => $instance['meta_value'], 'include' => !empty($instance['include']) ? explode(',', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? explode(',', $instance['exclude']) : '', 'search' => $instance['search'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'offset' => !empty($instance['offset']) ? intval($instance['offset']) : '', 'number' => !empty($instance['number']) ? intval($instance['number']) : '');
/* Output the theme's $before_widget wrapper. */
echo $before_widget;
/* If a title was input by the user, display it. */
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
/* Get users. */
$users = get_users($args);
/* If users were found. */
if (!empty($users)) {
echo '<ul class="xoxo users">';
/* Loop through each available user, creating a list item with a link to the user's archive. */
foreach ($users as $user) {
$url = get_author_posts_url($user->ID, $user->user_nicename);
$class = "user-{$user->ID}";
if (is_author($user->ID)) {
$class .= ' current-user';
}
echo "<li class='{$class}'><a href='{$url}' title='" . esc_attr($user->display_name) . "'>{$user->display_name}</a></li>\n";
}
echo '</ul>';
}
/* Close the theme's widget wrapper. */
echo $after_widget;
}
开发者ID:fwelections,项目名称:fwelections,代码行数:35,代码来源:widget-users.php
示例3: activate
function activate()
{
global $wpdb;
if (!get_option("lrp_database_establish")) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$table_name = $wpdb->prefix . "lrp_documents_history";
$sql = "CREATE TABLE " . $table_name . " (\n\t\t\t\t id bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t\t post bigint(20),\n\t\t\t\t lrnode bigint(20),\n\t\t\t\t lrkey bigint(20),\n\t\t\t\t lrschema bigint(20),\n\t\t\t\t lruser bigint(20),\n\t\t\t\t lraction varchar(100),\n\t\t\t\t lrdocid varchar(100),\n\t\t\t\t date_submitted bigint(20),\n\t\t\t\t UNIQUE KEY id(id)\n\t\t\t\t);";
dbDelta($sql);
add_option("lrp_database_establish", 1);
}
$get_users = get_users();
foreach ($get_users as $user) {
if (in_array("administrator", $user->roles)) {
$user = new WP_User($user->data->ID);
foreach ($this->AdministratorCapabilities as $capability) {
$user->add_cap($capability);
}
}
if (in_array("editor", $user->roles)) {
$user = new WP_User($user->data->ID);
foreach ($this->EditorCapabilities as $capability) {
$user->add_cap($capability);
}
}
if (in_array("author", $user->roles)) {
$user = new WP_User($user->data->ID);
foreach ($this->AuthorCapabilities as $capability) {
$user->add_cap($capability);
}
}
}
}
开发者ID:navnorth,项目名称:wp-learning-registry-publisher,代码行数:32,代码来源:learning-registry-publisher.php
示例4: widget
function widget($args, $instance)
{
extract(array_merge(array('title' => ''), $instance));
$authors = get_users(array('orderby' => 'post_count', 'order' => 'DESC'));
if (isset($before_widget)) {
echo $before_widget;
}
echo '<aside id="tt_authors_widget" class="widget tt-authors-widget tt-widget">';
if ($title != '') {
echo $args['before_title'] . $title . $args['after_title'];
}
echo '<ul>';
foreach ($authors as $author) {
echo '<li>';
echo '<span class="widget-thumb">';
echo get_avatar($author->ID, 55);
echo '</span>';
echo '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" class="widget-item-title" title="">' . $author->display_name . '</a>';
echo '<ul>
<li class="comments-number"><a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="">' . count_user_posts($author->ID) . ' ' . (count_user_posts($author->ID) > 1 ? __('posts', 'themeton') : __('post', 'themeton')) . '</a></li>
</ul>';
echo '</li>';
}
echo '</ul>';
echo '</aside>';
if (isset($after_widget)) {
echo $after_widget;
}
wp_reset_query();
}
开发者ID:petersondrs,项目名称:tellura,代码行数:30,代码来源:authors_widget.php
示例5: include_professors
function include_professors()
{
$admin_id = get_user_id_from_string(get_blog_option($current_blog->blog_id, 'admin_email'));
$blog_major = get_user_major();
//get_the_user_major($admin_id);
//var_dump($blog_major);
if ($GLOBALS['blog_id'] != 1) {
//makes sure it's not the root blog
$args = array('blog_id' => 1, 'role' => 'professor');
$professors = get_users($args);
//get all profs from root blog
//loop through profs, add as user if same major, delete if different major
foreach ($professors as $professor) {
$prof_major = get_the_user_major($professor->ID);
//var_dump($prof_major);
if ($prof_major == $blog_major) {
$current_role = get_the_user_role($professor);
if ($current_role != 'Administrator') {
$result = add_existing_user_to_blog(array('user_id' => $professor->ID, 'role' => 'professor'));
}
} else {
$result = remove_user_from_blog($professor->ID, $current_blog->blog_id);
}
}
}
//end if
}
开发者ID:ryanshoover,项目名称:seufolios,代码行数:27,代码来源:role_setup.php
示例6: acfw_activate
function acfw_activate()
{
$users = get_users('meta_key=acfw_dismiss_expired');
foreach ($users as $user) {
delete_user_meta($user->id, 'acfw_dismiss_expired');
}
}
开发者ID:nusserstudios,项目名称:acf-widgets,代码行数:7,代码来源:acf-widgets.php
示例7: draw_user_list
function draw_user_list()
{
$users = get_users();
?>
<table class="userlist table table-condensed table-bordered">
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Username</th>
</tr>
<?php
while ($row = $users->fetch_array()) {
$row['role'] = get_role($row['user_id']);
echo '<tr class="userlist ';
echo 'userlist-' . $row['role'];
if ($row['inactive']) {
echo ' userlist-inactive';
}
echo '" onclick="openEdit(' . $row['user_id'] . ')">';
echo '<td style="cursor:pointer;">' . $row['lname'] . "</td>";
echo '<td style="cursor:pointer;">' . $row['fname'] . "</td>";
echo '<td style="cursor:pointer;">' . $row['username'] . "</td>";
echo '</tr>';
}
?>
</table>
<?php
}
开发者ID:rogerapras,项目名称:php_timeclock,代码行数:28,代码来源:manage_users.php
示例8: bp_blogs_record_existing_blogs
/**
* Populates the BP blogs table with existing blogs.
*
* @package BuddyPress Blogs
*
* @global object $bp BuddyPress global settings
* @global object $wpdb WordPress database object
* @uses get_users()
* @uses bp_blogs_record_blog()
*/
function bp_blogs_record_existing_blogs()
{
global $bp, $wpdb;
// Truncate user blogs table and re-record.
$wpdb->query("TRUNCATE TABLE {$bp->blogs->table_name}");
if (is_multisite()) {
$blog_ids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0"));
} else {
$blog_ids = 1;
}
if ($blog_ids) {
foreach ((array) $blog_ids as $blog_id) {
$users = get_users(array('blog_id' => $blog_id));
$subscribers = get_users(array('blog_id' => $blog_id, 'role' => 'subscriber'));
if (!empty($users)) {
foreach ((array) $users as $user) {
// Don't record blogs for subscribers
if (!in_array($user, $subscribers)) {
bp_blogs_record_blog($blog_id, $user->ID, true);
}
}
}
}
}
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:35,代码来源:bp-blogs-functions.php
示例9: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$instance = wp_parse_args((array) $instance, array('title' => __('Blog Authors', 'academy'), 'number' => '6', 'order' => 'registered'));
$orderdir = 'DESC';
if ($instance['order'] == 'display_name') {
$orderdir = 'ASC';
}
$title = apply_filters('widget_title', empty($instance['title']) ? __('Blog Authors', 'academy') : $instance['title'], $instance, $this->id_base);
$out = $before_widget;
$out .= $before_title . $title . $after_title;
$counter = 0;
$users = get_users(array('number' => $instance['number'], 'orderby' => $instance['order'], 'order' => $orderdir));
$out .= '<div class="users-listing">';
foreach ($users as $user) {
$name = trim($user->first_name . ' ' . $user->last_name);
$counter++;
$out .= '<div class="user-image ';
if ($counter == 3) {
$out .= 'last';
}
$out .= '"><div class="bordered-image">';
$out .= '<a title="' . $name . '" href="' . get_author_posts_url($user->ID) . '">' . get_avatar($user->ID) . '</a>';
$out .= '</div></div>';
if ($counter == 3) {
$out .= '<div class="clear"></div>';
$counter = 0;
}
}
$out .= '</div>';
$out .= $after_widget;
echo $out;
}
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:33,代码来源:themex.authors.php
示例10: simpleSubscribeUninstall
/**
* Uninstall function
*/
function simpleSubscribeUninstall()
{
global $wpdb;
/**
* 1. Prepare tables to be deleted, go thru tables, check if they exist, and remove
*/
$removeTables = array($wpdb->prefix . "subscribers", $wpdb->prefix . "subscribers_log");
foreach ($removeTables as $table) {
$wpdb->query("DROP TABLE IF EXISTS `" . $table . "`");
}
/**
* 2. Delete simple subcribe options
*/
delete_option('simpleSubscribe');
/**
* 3. Delete user meta
*/
$registeredUsers = get_users(array('meta_key' => 'subscription', 'meta_value' => 1));
if (!empty($registeredUsers)) {
foreach ($registeredUsers as $user) {
delete_user_meta($user->data->ID, 'subscription');
delete_user_meta($user->data->ID, 'subscribersPerPage');
}
}
}
开发者ID:ntamvl,项目名称:planningelegance,代码行数:28,代码来源:uninstall.php
示例11: bnfw_render_users_dropdown
/**
* Render users dropdown.
*
* @since 1.3.6
*/
function bnfw_render_users_dropdown($selected_users)
{
global $wp_roles;
?>
<optgroup label="User Roles">
<?php
$roles = $wp_roles->get_names();
foreach ($roles as $role) {
$selected = selected(true, in_array('role-' . $role, $selected_users), false);
echo '<option value="role-', $role, '" ', $selected, '>', $role, '</option>';
}
?>
</optgroup>
<optgroup label="Users">
<?php
$user_count = count_users();
// if there are more than 100 users then use AJAX to load them dynamically.
// So just get only the selected users
if (count($selected_users) > 0 && $user_count['total_users'] > 100) {
$users = get_users(array('include' => $selected_users, 'order_by' => 'email', 'fields' => array('ID', 'user_login')));
} else {
$users = get_users(array('order_by' => 'email', 'number' => 100, 'fields' => array('ID', 'user_login')));
}
foreach ($users as $user) {
$selected = selected(true, in_array($user->ID, $selected_users), false);
echo '<option value="', $user->ID, '" ', $selected, '>', $user->user_login, '</option>';
}
}
开发者ID:alvarpoon,项目名称:aeg,代码行数:33,代码来源:helpers.php
示例12: load_users
/**
* Generates array of users indexed by user ID, and
* an array of user_nicenames, indexed by user ID.
*
* @compat < 3.1: Use $wpdb and get_users of blog.
*/
function load_users()
{
global $wpdb;
// < 3.1
// Cache the user information.
if (!empty($this->users)) {
return $this->users;
}
if (function_exists('get_users')) {
// >= 3.1
$users = get_users();
foreach ($users as $user) {
$this->users[$user->ID] = $user;
$this->names[$user->ID] = $user->user_nicename;
}
} else {
// < 3.1
$users = get_users_of_blog();
$user_ids = '';
foreach ($users as $user) {
$this->users[$user->ID] = $user;
$user_ids .= $user->ID;
}
foreach ($wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} WHERE ID IN({$user_ids})") as $user) {
$this->users[$user->ID]->user_nicename = $user->user_nicename;
$this->names[$user->ID] = $user->user_nicename;
}
}
return $this->users;
}
开发者ID:rajbot,项目名称:tikirobot_p2,代码行数:36,代码来源:mentions.php
示例13: ffck_check_user
function ffck_check_user($member_data)
{
//look for a wordpress user with same licence id
echo $member_data['firstname'] . ' ' . $member_data['lastname'] . ' ';
$existing_users = get_users(array('meta_key' => 'FFCK_licence', 'meta_value' => $member_data['licence_id']));
if (sizeof($existing_users) > 1) {
echo "ERROR multiple matches for licence " . $member_data['licence_id'];
} elseif (sizeof($existing_users) == 1) {
//licence id match. update account
echo "Updating... ";
ffck_update_user($existing_users[0], $member_data);
} else {
//look for a wordpress user with same email
$existing_users = get_users(array('search' => $member_data['email']));
//for each match,
foreach ($existing_users as $existing_user) {
//different licence_id, skip
if ($existing_user->has_prop('ffck_licence') && strcmp($existing_user->get('ffck_licence'), $member_data['licence_id']) != 0) {
echo "Skipping " . $existing_user->first_name . ", ";
continue;
} else {
if (!$existing_user->has_prop('ffck_licence')) {
echo "Updating... ";
ffck_update_user($existing_user, $member_data);
echo PHP_EOL;
return;
}
}
}
//no matching user, create new one
echo "Creating... ";
ffck_create_user($member_data);
}
echo PHP_EOL;
}
开发者ID:thomaswillecomme,项目名称:ffck_users_sync,代码行数:35,代码来源:actions.php
示例14: members_delete_role
/**
* Function for safely deleting a role and transferring the deleted role's users to the default
* role. Note that this function can be extremely intensive. Whenever a role is deleted, it's
* best for the site admin to assign the user's of the role to a different role beforehand.
*
* @since 0.2.0
* @access public
* @param string $role
* @return void
*/
function members_delete_role($role)
{
// Get the default role.
$default_role = get_option('default_role');
// Don't delete the default role. Site admins should change the default before attempting to delete the role.
if ($role == $default_role) {
return;
}
// Get all users with the role to be deleted.
$users = get_users(array('role' => $role));
// Check if there are any users with the role we're deleting.
if (is_array($users)) {
// If users are found, loop through them.
foreach ($users as $user) {
// If the user has the role and no other roles, set their role to the default.
if ($user->has_cap($role) && 1 >= count($user->roles)) {
$user->set_role($default_role);
} else {
if ($user->has_cap($role)) {
$user->remove_role($role);
}
}
}
}
// Remove the role.
remove_role($role);
// Remove the role from the role factory.
members_role_factory()->remove_role($role);
}
开发者ID:vunh1989,项目名称:vodphoto,代码行数:39,代码来源:functions-admin.php
示例15: notify_new_topic
/**
* Notify user roles on new topic
*/
public function notify_new_topic($topic_id = 0, $forum_id = 0, $anonymous_data = 0, $topic_author = 0)
{
$user_roles = Falcon::get_option('bbsub_topic_notification', array());
// bail out if no user roles found
if (!$user_roles) {
return;
}
$recipients = array();
foreach ($user_roles as $role) {
$users = get_users(array('role' => $role, 'fields' => array('ID', 'user_email', 'display_name')));
$recipients = array_merge($recipients, $users);
}
// still no users?
if (!$recipients) {
return;
}
// subscribe the users automatically
foreach ($recipients as $user) {
bbp_add_user_subscription($user->ID, $topic_id);
}
// Sanitize the HTML into text
$content = apply_filters('bbsub_html_to_text', bbp_get_topic_content($topic_id));
// Build email
$text = "%1\$s\n\n";
$text .= "---\nReply to this email directly or view it online:\n%2\$s\n\n";
$text .= "You are receiving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.";
$text = sprintf($text, $content, bbp_get_topic_permalink($topic_id));
$text = apply_filters('bbsub_topic_email_message', $text, $topic_id, $content);
$subject = apply_filters('bbsub_topic_email_subject', 'Re: [' . get_option('blogname') . '] ' . bbp_get_topic_title($topic_id), $topic_id);
$options = array('author' => bbp_get_topic_author_display_name($topic_id), 'id' => $topic_id);
$this->handler->send_mail($recipients, $subject, $text, $options);
do_action('bbp_post_notify_topic_subscribers', $topic_id, $recipients);
}
开发者ID:rmccue,项目名称:Falcon,代码行数:36,代码来源:bbPress.php
示例16: qq_oauth
function qq_oauth()
{
$code = $_GET['code'];
$token_url = "https://graph.qq.com/oauth2.0/token?client_id=" . QQ_APPID . "&client_secret=" . QQ_APPSECRET . "&grant_type=authorization_code&redirect_uri=" . urlencode(home_url()) . "&code=" . $code;
$response = wp_remote_get($token_url);
$response = $response['body'];
if (strpos($response, "callback") !== false) {
wp_redirect(home_url());
}
$params = array();
parse_str($response, $params);
$qq_access_token = $params["access_token"];
$graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $qq_access_token;
$str = wp_remote_get($graph_url);
$str = $str['body'];
if (strpos($str, "callback") !== false) {
$lpos = strpos($str, "(");
$rpos = strrpos($str, ")");
$str = substr($str, $lpos + 1, $rpos - $lpos - 1);
}
$user = json_decode($str, true);
if (isset($user->error)) {
echo "<h3>错误代码:</h3>" . $user->error;
echo "<h3>信息 :</h3>" . $user->error_description;
exit;
}
$qq_openid = $user['openid'];
if (!$qq_openid) {
wp_redirect(home_url());
exit;
}
$get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $qq_access_token . "&oauth_consumer_key=" . QQ_APPID . "&openid=" . $qq_openid . "&format=json";
$data = wp_remote_get($get_user_info);
$data = $data['body'];
$data = json_decode($data, true);
$username = $data['nickname'];
$avatar = $data['figureurl_2'];
if (is_user_logged_in()) {
$this_user = wp_get_current_user();
update_user_meta($this_user->ID, "qq_openid", $qq_openid);
update_user_meta($this_user->ID, "qq_avatar", $avatar);
fa_qq_oauth_redirect();
} else {
$user_qq = get_users(array("meta_key " => "qq_openid", "meta_value" => $qq_openid));
if (is_wp_error($user_qq) || !count($user_qq)) {
$login_name = wp_create_nonce($qq_openid);
$random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
$userdata = array('user_login' => $login_name, 'display_name' => $username, 'user_pass' => $random_password, 'nick_name' => $username);
$user_id = wp_insert_user($userdata);
wp_signon(array("user_login" => $login_name, "user_password" => $random_password), false);
update_user_meta($user_id, "qq_openid", $qq_openid);
update_user_meta($user_id, "qq_avatar", $avatar);
fa_qq_oauth_redirect();
} else {
wp_set_auth_cookie($user_qq[0]->ID);
update_user_meta($user_qq[0]->ID, "qq_avatar", $avatar);
fa_qq_oauth_redirect();
}
}
}
开发者ID:yarec,项目名称:wp-oauth,代码行数:60,代码来源:auth-qq.php
示例17: send_activity_report
public static function send_activity_report()
{
$current_time = current_time('timestamp');
$mostly_recent_users = get_users(array('meta_key' => 'displet_last_login', 'meta_value' => $current_time - 60 * 60 * 24 * 7, 'meta_compare' => '>'));
$recent_users = array();
if (!empty($mostly_recent_users) && is_array($mostly_recent_users)) {
$edit_url = admin_url('admin.php?page=displet-lead-manager&user_id=');
foreach ($mostly_recent_users as $user) {
if (!empty($user->displet_last_login) && is_numeric($user->displet_last_login)) {
$logins_for_day = 0;
if (!empty($user->displet_logins) && is_array($user->displet_logins)) {
foreach ($user->displet_logins as $login) {
if ($login > $current_time - 60 * 60 * 24) {
$logins_for_day++;
}
}
}
$property_stats = DispletRetsIdxViewedPropertiesController::get_property_view_stats($user->displet_user_properties);
$recent_users[] = array('url' => $edit_url . $user->ID, 'name' => $user->nickname, 'phone' => $user->displet_phone, 'logins_for_day' => $logins_for_day, 'logins_total' => count($user->displet_logins), 'price_average' => $property_stats['price_average'], 'zip_mode' => $property_stats['zip_mode']);
}
}
}
if (!empty($recent_users)) {
$user_activity_report = '<table cellpadding="3" width="100%"><tr><th>Name</th><th>Phone</th><th>Logins In Last Day</th><th>Total Logins</th><th>Average Price</th><th>Most Frequented Zip Code</th></tr>';
foreach ($recent_users as $user) {
$price_average = !empty($user['price_average']) ? number_format($user['price_average']) : '';
$user_activity_report .= '<tr><td align="left"><a href="' . $user['url'] . '">' . $user['name'] . '</a></td><td align="center">' . $user['phone'] . '</td><td align="center">' . $user['logins_for_day'] . '</td><td align="center">' . $user['logins_total'] . '</td><td align="center">$' . $price_average . '</td><td align="center">' . $user['zip_mode'] . '</td></tr>';
}
$user_activity_report .= '</table>';
new DispletRetsIdxEmail('activity_report', array('activity_report' => $user_activity_report));
}
}
开发者ID:amankatoch,项目名称:wp-plugin,代码行数:32,代码来源:class-displet-rets-idx-email-controller.php
示例18: check_user_exists
static function check_user_exists($username)
{
global $wpdb;
//if username is empty just return false
if ($username == '') {
return false;
}
//If multisite
if (AIOWPSecurity_Utility::is_multisite_install()) {
$blog_id = get_current_blog_id();
$admin_users = get_users('blog_id=' . $blog_id . 'orderby=login&role=administrator');
$acct_name_exists = false;
foreach ($admin_users as $user) {
if ($user->user_login == $username) {
$acct_name_exists = true;
break;
}
}
return $acct_name_exists;
}
//check users table
//$user = $wpdb->get_var( "SELECT user_login FROM `" . $wpdb->users . "` WHERE user_login='" . sanitize_text_field( $username ) . "';" );
$sql_1 = $wpdb->prepare("SELECT user_login FROM {$wpdb->users} WHERE user_login=%s", sanitize_text_field($username));
$user = $wpdb->get_var($sql_1);
$sql_2 = $wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE ID=%s", sanitize_text_field($username));
$userid = $wpdb->get_var($sql_2);
if ($user == $username || $userid == $username) {
return true;
} else {
return false;
}
}
开发者ID:treydonovan,项目名称:mymexicotours,代码行数:32,代码来源:wp-security-utility.php
示例19: get_users
function get_users()
{
$return['users'] = get_users();
$response = new WP_JSON_Response();
$response->set_data($return);
return $response;
}
开发者ID:ratan203,项目名称:wp-app-plugin,代码行数:7,代码来源:sg-api-routes.php
示例20: estate_register_meta_boxes
function estate_register_meta_boxes($meta_boxes)
{
$prefix = 'estate_';
$agents = array('' => __('None', 'tt'));
// Get all users with role "agent"
$all_agents = get_users(array('role' => 'agent', 'fields' => 'ID'));
foreach ($all_agents as $agent) {
$agents[$agent] = get_user_meta($agent, 'first_name', true) . ' ' . get_user_meta($agent, 'last_name', true);
}
/* PROPERTY
============================== */
$meta_boxes[] = array('id' => 'property_settings', 'title' => __('Property Settings', 'tt'), 'pages' => array('property'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Property Layout', 'tt'), 'id' => "{$prefix}property_layout", 'desc' => __('Choose Property Layout.', 'tt'), 'type' => 'select', 'options' => array('theme_option_setting' => __('Theme Option Setting', 'tt'), 'full_width' => __('Full Width', 'tt'), 'boxed' => __('Boxed', 'tt')), 'std' => 'theme_option_setting'), array('name' => __('Property Status Update', 'tt'), 'id' => "{$prefix}property_status_update", 'desc' => __('E.g. "Sold", "Rented Out" etc.', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('name' => __('Featured Property', 'tt'), 'id' => "{$prefix}property_featured", 'type' => 'checkbox', 'std' => 0), array('name' => __('Property Video Provider', 'tt'), 'id' => "{$prefix}property_video_provider", 'desc' => __('', 'tt'), 'type' => 'select', 'options' => array('none' => __('None', 'tt'), 'youtube' => __('YouTube', 'tt'), 'vimeo' => __('Vimeo', 'tt'))), array('name' => __('Property Video ID', 'tt'), 'id' => "{$prefix}property_video_id", 'desc' => __('', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('name' => __('Property Images', 'tt'), 'id' => "{$prefix}property_images", 'type' => 'image_advanced', 'max_file_uploads' => 100), array('name' => __('Property ID', 'tt'), 'id' => "{$prefix}property_id", 'desc' => __('', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('name' => __('Address', 'tt'), 'id' => "{$prefix}property_address", 'desc' => __('', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('id' => "{$prefix}property_location", 'name' => __('Google Maps', 'tt'), 'desc' => __('Enter Property Address Above, Then Click "Find Address" To Search For Exact Location On The Map. Drag & Drop Map Marker If Necessary.', 'tt'), 'type' => 'map', 'std' => '', 'style' => 'width: 400px; height: 200px; margin-bottom: 1em', 'address_field' => "{$prefix}property_address"), array('name' => __('Available From', 'tt'), 'id' => "{$prefix}property_available_from", 'type' => 'date', 'js_options' => array('appendText' => __('(YYYYMMDD)', 'tt'), 'dateFormat' => __('yymmdd', 'tt'), 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => false)), array('name' => __('Property Price Prefix', 'tt'), 'id' => "{$prefix}property_price_prefix", 'desc' => __('Appears Before Property Price (i.e. "from")', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('name' => __('Property Price', 'tt'), 'id' => "{$prefix}property_price", 'desc' => __('Digits Only. Enter "-1" for "Price Upon Request"', 'tt'), 'type' => 'number', 'std' => __('1000', 'tt'), 'step' => 0.01, 'min' => '-1'), array('name' => __('Property Price Suffix', 'tt'), 'id' => "{$prefix}property_price_text", 'desc' => __('Appears After Property Price (i.e. "per month")', 'tt'), 'type' => 'text', 'std' => __('', 'tt')), array('name' => __('Size', 'tt'), 'id' => "{$prefix}property_size", 'desc' => __('Property Size (Digits Only, i.e. "250")', 'tt'), 'type' => 'number', 'std' => __('250', 'tt'), 'step' => 0.01), array('name' => __('Size Unit', 'tt'), 'id' => "{$prefix}property_size_unit", 'desc' => __('Unit Appears After Property Size (i.e. "sq ft")', 'tt'), 'type' => 'text', 'std' => __('sq ft', 'tt')), array('name' => __('Rooms', 'tt'), 'id' => "{$prefix}property_rooms", 'type' => 'number', 'prefix' => __('', 'tt'), 'suffix' => __('', 'tt'), 'min' => 0, 'step' => 0.5), array('name' => __('Bedrooms', 'tt'), 'id' => "{$prefix}property_bedrooms", 'type' => 'number', 'prefix' => __('', 'tt'), 'suffix' => __('', 'tt'), 'min' => 0, 'step' => 0.5), array('name' => __('Bathrooms', 'tt'), 'id' => "{$prefix}property_bathrooms", 'type' => 'number', 'prefix' => __('', 'tt'), 'suffix' => __('', 'tt'), 'min' => 0, 'step' => 0.5), array('name' => __('Garages', 'tt'), 'id' => "{$prefix}property_garages", 'type' => 'number', 'prefix' => __('', 'tt'), 'suffix' => __('', 'tt'), 'min' => 0, 'step' => 0.5), array('name' => __('Contact Information', 'tt'), 'id' => "{$prefix}property_contact_information", 'type' => 'select', 'options' => array('all' => __('Profile Information & Contact Form', 'tt'), 'form' => __('Contact Form Only', 'tt'), 'none' => __('None', 'tt')), 'std' => 'all'), array('name' => __('Assign Agent', 'tt'), 'id' => "{$prefix}property_custom_agent", 'desc' => __('Selected agent will be able to edit this property.', 'tt'), 'type' => 'select', 'options' => $agents), array('name' => __('Internal Note', 'tt'), 'id' => "{$prefix}internal_note", 'desc' => __('Note for internal use. Won\'t appear on the frontend.', 'tt'), 'type' => 'textarea', 'std' => __('', 'tt')), array('name' => __('Attachments', 'tt'), 'id' => "{$prefix}property_attachments", 'desc' => __('', 'tt'), 'type' => 'file_advanced', 'std' => __('', 'tt'))));
/* TESTIMONIAL
============================== */
$meta_boxes[] = array('id' => 'testimonial_settings', 'title' => __('Testimonial', 'tt'), 'pages' => array('testimonial'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Testimonial Text', 'tt'), 'id' => "{$prefix}testimonial_text", 'type' => 'textarea', 'std' => __('', 'tt'))));
/* POST TYPE "GALLERY"
============================== */
$meta_boxes[] = array('id' => 'post_type_gallery', 'title' => __('Gallery Settings', 'tt'), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Gallery Images', 'tt'), 'id' => "{$prefix}post_gallery", 'type' => 'image_advanced', 'max_file_uploads' => 100)));
/* POST TYPE "VIDEO"
============================== */
$meta_boxes[] = array('id' => 'post_type_video', 'title' => __('Video Settings', 'tt'), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => 'Full Video URL', 'id' => "{$prefix}post_video_url", 'desc' => 'Insert Full Video URL (i.e. <strong>http://vimeo.com/99370876</strong>)', 'type' => 'text', 'std' => '')));
/* PAGE SETTINGS
============================== */
$meta_boxes[] = array('id' => 'pages_settings', 'title' => __('Page Settings', 'tt'), 'pages' => array('post', 'page', 'property', 'agent'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Hide Sidebar', 'tt'), 'id' => "{$prefix}page_hide_sidebar", 'type' => 'checkbox', 'std' => 0), array('name' => __('Intro Fullscreen Background Slideshow Images', 'tt'), 'id' => "{$prefix}intro_fullscreen_background_slideshow_images", 'class' => 'intro-only', 'type' => 'image_advanced', 'max_file_uploads' => 100)));
// Page Template "Property - Slideshow"
$meta_boxes[] = array('id' => 'slideshow_settings', 'title' => __('Slideshow Settings', 'tt'), 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Type', 'tt'), 'id' => "{$prefix}property_slideshow_type", 'desc' => __('', 'tt'), 'type' => 'select', 'options' => array('featured' => __('Featured Properties', 'tt'), 'latest' => __('Latest Three Properties', 'tt'), 'selected' => __('Selected Properties (choose below)', 'tt')), 'std' => 'latest'), array('name' => __('Selected Properties', 'tt'), 'id' => "{$prefix}property_slideshow_selected_properties", 'type' => 'post', 'post_type' => 'property', 'fie
|
请发表评论