本文整理汇总了PHP中wp_is_large_network函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_is_large_network函数的具体用法?PHP wp_is_large_network怎么用?PHP wp_is_large_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_is_large_network函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bp_blogs_record_existing_blogs
/**
* Populate the BP blogs table with existing blogs.
*
* @since BuddyPress (1.0.0)
*
* @global object $wpdb WordPress database object.
* @uses get_users()
* @uses bp_blogs_record_blog()
*
* @return bool
*/
function bp_blogs_record_existing_blogs()
{
global $wpdb;
// Query for all sites in network
if (is_multisite()) {
// Get blog ID's if not a large network
if (!wp_is_large_network()) {
$blog_ids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0 AND site_id = %d", $wpdb->siteid));
// If error running this query, set blog ID's to false
if (is_wp_error($blog_ids)) {
$blog_ids = false;
}
// Large networks are not currently supported
} else {
$blog_ids = false;
}
// Record a single site
} else {
$blog_ids = $wpdb->blogid;
}
// Bail if there are no blogs in the network
if (empty($blog_ids)) {
return false;
}
// Get BuddyPress
$bp = buddypress();
// Truncate user blogs table
$truncate = $wpdb->query("TRUNCATE {$bp->blogs->table_name}");
if (is_wp_error($truncate)) {
return false;
}
// Truncate user blogsmeta table
$truncate = $wpdb->query("TRUNCATE {$bp->blogs->table_name_blogmeta}");
if (is_wp_error($truncate)) {
return false;
}
// Loop through users of blogs and record the relationship
foreach ((array) $blog_ids as $blog_id) {
// Ensure that the cache is clear after the table TRUNCATE above
wp_cache_delete($blog_id, 'blog_meta');
// Get all users
$users = get_users(array('blog_id' => $blog_id));
// Continue on if no users exist for this site (how did this happen?)
if (empty($users)) {
continue;
}
// Loop through users and record their relationship to this blog
foreach ((array) $users as $user) {
bp_blogs_add_user_to_blog($user->ID, false, $blog_id);
}
}
/**
* Fires after the BP blogs tables have been populated with existing blogs.
*
* @since BuddyPress (2.4.0)
*/
do_action('bp_blogs_recorded_existing_blogs');
// No errors
return true;
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:71,代码来源:bp-blogs-functions.php
示例2: prepare_items
/**
*
* @global string $usersearch
* @global string $role
* @global wpdb $wpdb
* @global string $mode
*/
public function prepare_items() {
global $usersearch, $role, $wpdb, $mode;
$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
$users_per_page = $this->get_items_per_page( 'users_network_per_page' );
$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
$paged = $this->get_pagenum();
$args = array(
'number' => $users_per_page,
'offset' => ( $paged-1 ) * $users_per_page,
'search' => $usersearch,
'blog_id' => 0,
'fields' => 'all_with_meta'
);
if ( wp_is_large_network( 'users' ) )
$args['search'] = ltrim( $args['search'], '*' );
if ( $role == 'super' ) {
$logins = implode( "', '", get_super_admins() );
$args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
}
/*
* If the network is large and a search is not being performed,
* show only the latest users with no paging in order to avoid
* expensive count queries.
*/
if ( !$usersearch && wp_is_large_network( 'users' ) ) {
if ( !isset($_REQUEST['orderby']) )
$_GET['orderby'] = $_REQUEST['orderby'] = 'id';
if ( !isset($_REQUEST['order']) )
$_GET['order'] = $_REQUEST['order'] = 'DESC';
$args['count_total'] = false;
}
if ( isset( $_REQUEST['orderby'] ) )
$args['orderby'] = $_REQUEST['orderby'];
if ( isset( $_REQUEST['order'] ) )
$args['order'] = $_REQUEST['order'];
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );
$this->items = $wp_user_search->get_results();
$this->set_pagination_args( array(
'total_items' => $wp_user_search->get_total(),
'per_page' => $users_per_page,
) );
}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:65,代码来源:class-wp-ms-users-list-table.php
示例3: prepare_items
/**
*
* @global string $usersearch
* @global string $role
* @global wpdb $wpdb
* @global string $mode
*/
public function prepare_items()
{
global $usersearch, $role, $wpdb, $mode;
$usersearch = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : '';
$users_per_page = $this->get_items_per_page('users_network_per_page');
$role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
$paged = $this->get_pagenum();
$args = array('number' => $users_per_page, 'offset' => ($paged - 1) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta');
if (wp_is_large_network('users')) {
$args['search'] = ltrim($args['search'], '*');
} else {
if ('' !== $args['search']) {
$args['search'] = trim($args['search'], '*');
$args['search'] = '*' . $args['search'] . '*';
}
}
if ($role === 'super') {
$logins = implode("', '", get_super_admins());
$args['include'] = $wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE user_login IN ('{$logins}')");
}
/*
* If the network is large and a search is not being performed,
* show only the latest users with no paging in order to avoid
* expensive count queries.
*/
if (!$usersearch && wp_is_large_network('users')) {
if (!isset($_REQUEST['orderby'])) {
$_GET['orderby'] = $_REQUEST['orderby'] = 'id';
}
if (!isset($_REQUEST['order'])) {
$_GET['order'] = $_REQUEST['order'] = 'DESC';
}
$args['count_total'] = false;
}
if (isset($_REQUEST['orderby'])) {
$args['orderby'] = $_REQUEST['orderby'];
}
if (isset($_REQUEST['order'])) {
$args['order'] = $_REQUEST['order'];
}
if (!empty($_REQUEST['mode'])) {
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
set_user_setting('network_users_list_mode', $mode);
} else {
$mode = get_user_setting('network_users_list_mode', 'list');
}
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
$args = apply_filters('users_list_table_query_args', $args);
// Query the user IDs for this page
$wp_user_search = new WP_User_Query($args);
$this->items = $wp_user_search->get_results();
$this->set_pagination_args(array('total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page));
}
开发者ID:idies,项目名称:escience-2016-wp,代码行数:60,代码来源:class-wp-ms-users-list-table.php
示例4: get_context_labels
/**
* Return translated context labels
*
* @return array Context label translations
*/
public static function get_context_labels()
{
$labels = array();
if (is_multisite() && !wp_is_large_network()) {
$blogs = wp_get_sites();
foreach ($blogs as $blog) {
$blog_details = get_blog_details($blog['blog_id']);
$key = sanitize_key($blog_details->blogname);
$labels[$key] = $blog_details->blogname;
}
}
return $labels;
}
开发者ID:xwp,项目名称:stream-legacy,代码行数:18,代码来源:blogs.php
示例5: multisite_deactivate
/**
* Run the deactivation script on every blog for a multisite install
*
* @return void
*/
protected function multisite_deactivate()
{
/** @var wpdb $wpdb */
global $wpdb;
$site = get_current_site();
$blog_ids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id=%d", $site->id));
$large = wp_is_large_network();
foreach ($blog_ids as $blog) {
set_time_limit(30);
switch_to_blog($blog);
$large ? $this->short_blog_deactivate() : $this->blog_deactivate();
restore_current_blog();
}
}
开发者ID:hubbardsc,项目名称:field_day,代码行数:19,代码来源:Abstract_Deactivation.php
示例6: flush_rules
/**
* Thanks to Jeremy Felt.
*
* Source: https://jeremyfelt.com/2015/07/17/flushing-rewrite-rules-in-wordpress-multisite-for-fun-and-profit/
*/
public function flush_rules()
{
if (wp_is_large_network()) {
return;
}
if (isset($_GET['action']) && $_GET['action'] == 'flush-rules') {
$sites = wp_get_sites(array('network' => 1, 'limit' => 1000));
foreach ($sites as $site) {
switch_to_blog($site['blog_id']);
delete_option('rewrite_rules');
restore_current_blog();
}
}
}
开发者ID:jubstuff,项目名称:Flush-Network-Permalink,代码行数:19,代码来源:flush-network-permalink.php
示例7: update_options_callback
public function update_options_callback()
{
check_ajax_referer($_POST['referer'], 'nonce');
if (isset($_POST['multisite'])) {
$this->multisite = TRUE;
}
$this->update_option_boolean('display_deprecated');
$this->update_option_boolean('remove_nonstandard_capabilities_restore');
$this->update_option_boolean('override_edit_permissions');
$this->update_option_boolean('disable_navigation_menu_permissions');
if ($this->multisite && wp_is_large_network()) {
$this->update_option_boolean('enable_large_network_functionalities');
}
if ($this->main->enable_multisite_only_options($this->multisite)) {
$this->update_option_boolean('remove_data_on_uninstall', TRUE);
}
if (isset($_POST['custom-post-types'])) {
$custom_post_types = $_POST['custom-post-types'];
if (is_array($custom_post_types)) {
$post_type_values = $this->customize_permission_custom_post_types();
foreach ($custom_post_types as $key => $value) {
if ($value === 'true') {
if (!in_array($key, $post_type_values)) {
$post_type_values[] = $key;
}
} else {
if (in_array($key, $post_type_values)) {
$post_type_values = array_diff($post_type_values, array($key));
}
}
}
do_action('wpfront_ure_update_customize_permission_custom_post_types', $post_type_values, $this->customize_permission_custom_post_types());
$this->update_option('customize_permission_custom_post_types', implode(',', $post_type_values));
}
}
if ($this->multisite) {
echo network_admin_url('admin.php?page=' . self::MENU_SLUG . '&settings-updated=true');
} else {
echo admin_url('admin.php?page=' . self::MENU_SLUG . '&settings-updated=true');
}
die;
}
开发者ID:vignesh09,项目名称:IAMS,代码行数:42,代码来源:class-wpfront-user-role-editor-options.php
示例8: wp_migrate_db_pro_multisite_tools
/**
* Populate the $wpmdbpro_multisite_tools global with an instance of the WPMDBPro_Multisite_Tools class and return it.
*
* @param bool $cli
*
* @return WPMDBPro_Multisite_Tools The one true global instance of the WPMDBPro_Multisite_Tools class.
*/
function wp_migrate_db_pro_multisite_tools($cli = false)
{
global $wpmdbpro_multisite_tools;
if (!class_exists('WPMDBPro_Addon')) {
return false;
}
// Allows hooks to bypass the regular admin / ajax checks to force load the addon (required for the CLI addon).
$force_load = apply_filters('wp_migrate_db_pro_multisite_tools_force_load', false);
if (false === $force_load && !is_null($wpmdbpro_multisite_tools)) {
return $wpmdbpro_multisite_tools;
}
if (false === $force_load && (!function_exists('wp_migrate_db_pro_loaded') || !wp_migrate_db_pro_loaded() || is_multisite() && wp_is_large_network())) {
return false;
}
load_plugin_textdomain('wp-migrate-db-pro-multisite-tools', false, dirname(plugin_basename(__FILE__)) . '/languages/');
require_once dirname(__FILE__) . '/class/wpmdbpro-multisite-tools.php';
if ($cli) {
require_once dirname(__FILE__) . '/class/cli/wpmdbpro-multisite-tools-cli.php';
$wpmdbpro_multisite_tools = new WPMDBPro_Multisite_Tools_CLI(__FILE__);
} else {
$wpmdbpro_multisite_tools = new WPMDBPro_Multisite_Tools(__FILE__);
}
return $wpmdbpro_multisite_tools;
}
开发者ID:byadrenaline,项目名称:laseravalon_wp,代码行数:31,代码来源:wp-migrate-db-pro-multisite-tools.php
示例9: blog_exists
/**
* Checks if a blog exists and is not marked as deleted.
*
* @link http://wordpress.stackexchange.com/q/138300/73
* @param int $blog_id
* @param int $site_id
* @return bool
*/
function blog_exists($blog_id, $site_id = 0)
{
global $wpdb;
static $cache = array();
$site_id = (int) $site_id;
if (!function_exists('get_current_site')) {
return false;
}
if (0 === $site_id) {
$current_site = get_current_site();
$site_id = $current_site->id;
}
if (empty($cache) or empty($cache[$site_id])) {
if (wp_is_large_network()) {
// we do not test large sites.
return TRUE;
}
$query = "SELECT `blog_id` FROM {$wpdb->blogs}\n WHERE site_id = {$site_id} AND deleted = 0";
$result = $wpdb->get_col($query);
// Make sure the array is always filled with something.
if (empty($result)) {
$cache[$site_id] = array('do not check again');
} else {
$cache[$site_id] = $result;
}
}
return in_array($blog_id, $cache[$site_id]);
}
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:36,代码来源:user.php
示例10: wp_get_sites
/**
* Return an array of sites for a network or networks.
*
* @since 3.7.0
*
* @global wpdb $wpdb
*
* @param array $args {
* Array of default arguments. Optional.
*
* @type int|array $network_id A network ID or array of network IDs. Set to null to retrieve sites
* from all networks. Defaults to current network ID.
* @type int $public Retrieve public or non-public sites. Default null, for any.
* @type int $archived Retrieve archived or non-archived sites. Default null, for any.
* @type int $mature Retrieve mature or non-mature sites. Default null, for any.
* @type int $spam Retrieve spam or non-spam sites. Default null, for any.
* @type int $deleted Retrieve deleted or non-deleted sites. Default null, for any.
* @type int $limit Number of sites to limit the query to. Default 100.
* @type int $offset Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
* }
* @return array An empty array if the install is considered "large" via wp_is_large_network(). Otherwise,
* an associative array of site data arrays, each containing the site (network) ID, blog ID,
* site domain and path, dates registered and modified, and the language ID. Also, boolean
* values for whether the site is public, archived, mature, spam, and/or deleted.
*/
function wp_get_sites($args = array())
{
global $wpdb;
if (wp_is_large_network()) {
return array();
}
$defaults = array('network_id' => $wpdb->siteid, 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'limit' => 100, 'offset' => 0);
$args = wp_parse_args($args, $defaults);
$query = "SELECT * FROM {$wpdb->blogs} WHERE 1=1 ";
if (isset($args['network_id']) && (is_array($args['network_id']) || is_numeric($args['network_id']))) {
$network_ids = implode(',', wp_parse_id_list($args['network_id']));
$query .= "AND site_id IN ({$network_ids}) ";
}
if (isset($args['public'])) {
$query .= $wpdb->prepare("AND public = %d ", $args['public']);
}
if (isset($args['archived'])) {
$query .= $wpdb->prepare("AND archived = %d ", $args['archived']);
}
if (isset($args['mature'])) {
$query .= $wpdb->prepare("AND mature = %d ", $args['mature']);
}
if (isset($args['spam'])) {
$query .= $wpdb->prepare("AND spam = %d ", $args['spam']);
}
if (isset($args['deleted'])) {
$query .= $wpdb->prepare("AND deleted = %d ", $args['deleted']);
}
if (isset($args['limit']) && $args['limit']) {
if (isset($args['offset']) && $args['offset']) {
$query .= $wpdb->prepare("LIMIT %d , %d ", $args['offset'], $args['limit']);
} else {
$query .= $wpdb->prepare("LIMIT %d ", $args['limit']);
}
}
$site_results = $wpdb->get_results($query, ARRAY_A);
return $site_results;
}
开发者ID:Jitsufreak,项目名称:PJ,代码行数:63,代码来源:ms-functions.php
示例11: invite_anyone_is_large_network
/**
* Wrapper for wp_is_large_network() that supports non-MS.
*
* @since 1.1.2
*/
function invite_anyone_is_large_network()
{
if (function_exists('wp_is_large_network')) {
$is_large_network = wp_is_large_network('users');
$count = get_user_count();
} else {
global $wpdb;
$count = get_transient('ia_user_count');
if (false === $count) {
$count = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users} WHERE user_status = '0'");
set_transient('ia_user_count', $count, 60 * 60 * 24);
}
$is_large_network = $count > 10000;
return apply_filters('invite_anyone_is_large_network', $count > 10000, $count);
}
return apply_filters('invite_anyone_is_large_network', $is_large_network, $count);
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:22,代码来源:group-invites.php
示例12: prepare_query
//.........这里部分代码省略.........
$this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['offset'], $qv['number']);
} else {
$this->query_limit = $wpdb->prepare("LIMIT %d", $qv['number']);
}
}
$search = '';
if (isset($qv['search'])) {
$search = trim($qv['search']);
}
if ($search) {
$leading_wild = ltrim($search, '*') != $search;
$trailing_wild = rtrim($search, '*') != $search;
if ($leading_wild && $trailing_wild) {
$wild = 'both';
} elseif ($leading_wild) {
$wild = 'leading';
} elseif ($trailing_wild) {
$wild = 'trailing';
} else {
$wild = false;
}
if ($wild) {
$search = trim($search, '*');
}
$search_columns = array();
if ($qv['search_columns']) {
$search_columns = array_intersect($qv['search_columns'], array('ID', 'user_login', 'user_email', 'user_url', 'user_nicename'));
}
if (!$search_columns) {
if (false !== strpos($search, '@')) {
$search_columns = array('user_email');
} elseif (is_numeric($search)) {
$search_columns = array('user_login', 'ID');
} elseif (preg_match('|^https?://|', $search) && !(is_multisite() && wp_is_large_network('users'))) {
$search_columns = array('user_url');
} else {
$search_columns = array('user_login', 'user_nicename');
}
}
/**
* Filter the columns to search in a WP_User_Query search.
*
* The default columns depend on the search term, and include 'user_email',
* 'user_login', 'ID', 'user_url', and 'user_nicename'.
*
* @since 3.6.0
*
* @param array $search_columns Array of column names to be searched.
* @param string $search Text being searched.
* @param WP_User_Query $this The current WP_User_Query instance.
*/
$search_columns = apply_filters('user_search_columns', $search_columns, $search, $this);
$this->query_where .= $this->get_search_sql($search, $search_columns, $wild);
}
$blog_id = 0;
if (isset($qv['blog_id'])) {
$blog_id = absint($qv['blog_id']);
}
if (isset($qv['who']) && 'authors' == $qv['who'] && $blog_id) {
$qv['meta_key'] = $wpdb->get_blog_prefix($blog_id) . 'user_level';
$qv['meta_value'] = 0;
$qv['meta_compare'] = '!=';
$qv['blog_id'] = $blog_id = 0;
// Prevent extra meta query
}
$role = '';
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:67,代码来源:user.php
示例13: _e
_e('Network|Multisite Sitewide Login Security Settings', 'bulletproof-security');
?>
</label></strong><br />
<input type="submit" name="Submit-Net-LSM" class="button bps-button" style="margin:10px 0px 20px 0px;" value="<?php
esc_attr_e('Save Network LSM Options Sitewide', 'bulletproof-security');
?>
" />
</div>
</form>
<?php
// Network|Multisite: update/save Login Security DB option settings for all sites
if (isset($_POST['Submit-Net-LSM']) && current_user_can('manage_options')) {
check_admin_referer('bulletproof_security_net_lsm');
if (is_multisite()) {
if (wp_is_large_network()) {
echo '<div id="message" class="updated" style="border:1px solid #999999;margin-left:70px;background-color:#ffffe0;"><p>';
$text = '<font color="red"><strong>' . __('Error: Your Network site exceeds the default WP criteria for a large network site. Either you have more than 10,000 users or more than 10,000 sites. Please post a new forum thread in the BPS plugin support forum on wordpress.org for assistance.', 'bulletproof-security') . '</strong></font>';
echo $text;
echo '</p></div>';
return;
}
$successMessage = __(' LSM DB Options created or updated Successfully!', 'bulletproof-security');
$successTextBegin = '<font color="green"><strong>';
$successTextEnd = '</strong></font><br>';
$network_ids = wp_get_sites();
foreach ($network_ids as $key => $value) {
$net_id = $value['blog_id'];
$bps_Net_lsm = 'bulletproof_security_options_login_security';
$BPS_Net_LSM_Options = array('bps_max_logins' => '3', 'bps_lockout_duration' => '60', 'bps_manual_lockout_duration' => '60', 'bps_max_db_rows_display' => '', 'bps_login_security_OnOff' => 'On', 'bps_login_security_logging' => 'logLockouts', 'bps_login_security_errors' => 'wpErrors', 'bps_login_security_remaining' => 'On', 'bps_login_security_pw_reset' => 'enable', 'bps_login_security_sort' => 'ascending');
if (!get_blog_option($net_id, $bps_Net_lsm)) {
开发者ID:samoeba,项目名称:ultradia,代码行数:31,代码来源:wizard.php
示例14: __
$help .= '<p>' . __('You must assign a password to the new user, which they can change after logging in. The username, however, cannot be changed.') . '</p>' . '<p>' . __('New users will receive an email letting them know they’ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don’t want the password to be included in the welcome email.') . '</p>';
}
$help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $help));
get_current_screen()->add_help_tab(array('id' => 'user-roles', 'title' => __('User Roles'), 'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' . '<ul>' . '<li>' . __('Administrators have access to all the administration features.') . '</li>' . '<li>' . __('Editors can publish posts, manage posts as well as manage other people’s posts, etc.') . '</li>' . '<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' . '<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' . '<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' . '</ul>'));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
wp_enqueue_script('wp-ajax-response');
wp_enqueue_script('user-profile');
/**
* Filter whether to enable user auto-complete for non-super admins in Multisite.
*
* @since 3.4.0
*
* @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
*/
if (is_multisite() && current_user_can('promote_users') && !wp_is_large_network('users') && (is_super_admin() || apply_filters('autocomplete_users_for_site_admins', false))) {
wp_enqueue_script('user-suggest');
}
require_once ABSPATH . 'wp-admin/admin-header.php';
if (isset($_GET['update'])) {
$messages = array();
if (is_multisite()) {
switch ($_GET['update']) {
case "newuserconfirmation":
$messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.');
break;
case "add":
$messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.');
break;
case "addnoconfirmation":
$messages[] = __('User has been added to your site.');
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:31,代码来源:user-new.php
示例15: upgrade
/**
* Upgrades the settings.
*
* ## OPTIONS
*
* [--network-wide]
* : Perform the settings upgrade on all blogs of the network.
*
* ## EXAMPLES
*
* wp amt upgrade
* wp amt upgrade --network-wide
*
* @synopsis [--network-wide]
*/
function upgrade($args, $assoc_args)
{
// Multisite
if ($assoc_args['network-wide']) {
if (is_multisite()) {
// Check for large network
if (wp_is_large_network($using = 'sites')) {
WP_CLI::error('Too large network. Aborting...');
}
$blog_list = wp_get_sites();
//var_dump($blog_list);
if (empty($blog_list)) {
WP_CLI::error('No blogs could be found.');
// Check for large network is done above
}
foreach ($blog_list as $blog) {
switch_to_blog($blog['blog_id']);
$plugin_info = get_plugin_data(plugin_dir_path(__FILE__) . 'add-meta-tags.php', $markup = true, $translate = true);
WP_CLI::line('Upgrading settings of: ' . get_bloginfo('name') . ' - (ID: ' . $blog['blog_id'] . ')');
amt_plugin_upgrade();
restore_current_blog();
}
WP_CLI::success('Add-Meta-Tags settings have been upgraded network wide.');
} else {
WP_CLI::warning('No network detected. Reverting to single site mode.');
}
}
if (!is_multisite()) {
// Single site installation
amt_plugin_upgrade();
WP_CLI::success('Add-Meta-Tags settings have been upgraded.');
}
/*
if ( is_multisite() ) {
$blog_list = get_blog_list( 0, 'all' );
} else {
$blog_list = array();
$blog_list[] = array( 'blog_id' => 1 );
}
foreach ( $blog_list as $blog ) {
if ( is_multisite() ) {
switch_to_blog( $blog['blog_id'] );
}
$plugin_info = get_plugin_data( plugin_dir_path( __FILE__ ) . 'add-meta-tags.php', $markup = true, $translate = true );
WP_CLI::line( 'Upgrading settings of: ' . get_bloginfo('name') . ' - (ID: ' . $blog['blog_id'] . ')' );
amt_plugin_upgrade();
if ( is_multisite() ) {
restore_current_blog();
}
}
*/
// get_plugin_data( $plugin_file, $markup = true, $translate = true )
//$plugin info = get_plugin_data( AMT_PLUGIN_DIR . 'add-meta-tags.php', $markup = true, $translate = true );
// WP_CLI::line( ' ' );
// WP_CLI::line( count( $field_groups ) . ' field groups found for blog_id ' . $blog['blog_id'] );
// Print a success message
//WP_CLI::success( "Operation complete." );
}
开发者ID:ashenkar,项目名称:sanga,代码行数:74,代码来源:amt-cli.php
示例16: restore_current_blog
}
restore_current_blog();
wp_safe_redirect(add_query_arg('update', $update, $referer));
exit;
}
if (isset($_GET['action']) && 'update-site' == $_GET['action']) {
wp_safe_redirect($referer);
exit;
}
add_screen_option('per_page', array('label' => _x('Users', 'users per page (screen options)')));
$site_url_no_http = preg_replace('#^http(s)?://#', '', get_blogaddress_by_id($id));
$title_site_url_linked = sprintf(__('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id($id), $site_url_no_http);
$title = sprintf(__('Edit Site: %s'), $site_url_no_http);
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
if (current_user_can('promote_users') && apply_filters('show_network_site_users_add_existing_form', true) && !wp_is_large_network('users')) {
wp_enqueue_script('user-search');
}
require '../admin-header.php';
?>
<script type='text/javascript'>
/* <![CDATA[ */
var current_site_id = <?php
echo $id;
?>
;
/* ]]> */
</script>
开发者ID:nuevomediagroup,项目名称:WordPress,代码行数:29,代码来源:site-users.php
示例17: __
case 'unspam':
$msg = __('Site removed from spam.');
break;
case 'spam':
$msg = __('Site marked as spam.');
break;
default:
$msg = apply_filters('network_sites_updated_message_' . $_REQUEST['action'], __('Settings saved.'));
break;
}
if ($msg) {
$msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>';
}
}
$wp_list_table->prepare_items();
if (!wp_is_large_network('sites')) {
wp_enqueue_script('site-search');
}
require_once '../admin-header.php';
?>
<div class="wrap">
<?php
screen_icon('ms-admin');
?>
<h2><?php
_e('Sites');
echo $msg;
if (current_user_can('create_sites')) {
?>
<a href="<?php
开发者ID:nzeyimana,项目名称:WordPress,代码行数:31,代码来源:sites.php
示例18: wp_get_sites
/**
* Return an array of sites on the specified network. If no network is specified,
* return all sites, regardless of network.
*
* @todo REMOVE THIS FUNCTION! This function is moving to core. Use that one in favor of this. WordPress::wp_get_sites(). http://codex.wordpress.org/Function_Reference/wp_get_sites NOTE, This returns an array instead of stdClass. Be sure to update class.network-sites-list-table.php
* @since 2.9
* @deprecated 2.4.5
*
* @param array|string $args Optional. Specify the status of the sites to return.
*
* @return array An array of site data
*/
public function wp_get_sites($args = array())
{
global $wpdb;
if (wp_is_large_network()) {
return;
}
$defaults = array('network_id' => $wpdb->siteid);
$args = wp_parse_args($args, $defaults);
$query = "SELECT * FROM {$wpdb->blogs} WHERE 1=1 ";
if (isset($args['network_id']) && (is_array($args['network_id']) || is_numeric($args['network_id']))) {
$network_ids = array_map('intval', (array) $args['network_id']);
$network_ids = implode(',', $network_ids);
$query .= "AND site_id IN ({$network_ids}) ";
}
if (isset($args['public'])) {
$query .= $wpdb->prepare("AND public = %s ", $args['public']);
}
if (isset($args['archived'])) {
$query .= $wpdb->prepare("AND archived = %s ", $args['archived']);
}
if (isset($args['mature'])) {
$query .= $wpdb->prepare("AND mature = %s ", $args['mature']);
}
if (isset($args['spam'])) {
$query .= $wpdb->prepare("AND spam = %s ", $args['spam']);
}
if (isset($args['deleted'])) {
$query .= $wpdb->prepare("AND deleted = %s ", $args['deleted']);
}
if (isset($args['exclude_blogs'])) {
$query .= "AND blog_id NOT IN (" . implode(',', $args['exclude_blogs']) . ")";
}
$key = 'wp_get_sites:' . md5($query);
if (!($site_results = wp_cache_get($key, 'site-id-cache'))) {
$site_results = (array) $wpdb->get_results($query);
wp_cache_set($key, $site_results, 'site-id-cache');
}
return $site_results;
}
开发者ID:tinggao,项目名称:woofWarrior,代码行数:51,代码来源:class.jetpack-network.php
示例19: wp_ajax_autocomplete_user
/**
* Ajax handler for user autocomplete.
*
* @since 3.4.0
*/
function wp_ajax_autocomplete_user()
{
if (!is_multisite() || !current_user_can('promote_users') || wp_is_large_network('users')) {
wp_die(-1);
}
/** This filter is documented in wp-admin/user-new.php */
if (!is_super_admin() && !apply_filters('autocomplete_users_for_site_admins', false)) {
wp_die(-1);
}
$return = array();
// Check the type of request
// Current allowed values are `add` and `search`
if (isset($_REQUEST['autocomplete_type']) && 'search' === $_REQUEST['autocomplete_type']) {
$type = $_REQUEST['autocomplete_type'];
} else {
$type = 'add';
}
// Check the desired field for value
// Current allowed values are `user_email` and `user_login`
if (isset($_REQUEST['autocomplete_field']) && 'user_email' === $_REQUEST['autocomplete_field']) {
$field = $_REQUEST['autocomplete_field'];
} else {
$field = 'user_login';
}
// Exclude current users of this blog
if (isset($_REQUEST['site_id'])) {
$id = absint($_REQUEST['site_id']);
} else {
$id = get_current_blog_id();
}
$include_blog_users = $type == 'search' ? get_users(array('blog_id' => $id, 'fields' => 'ID')) : array();
$exclude_blog_users = $type == 'add' ? get_users(array('blog_id' => $id, 'fields' => 'ID')) : array();
$users = get_users(array('blog_id' => false, 'search' => '*' . $_REQUEST['term'] . '*', 'include' => $include_blog_users, 'exclude' => $exclude_blog_users, 'search_columns' => array('user_login', 'user_nicename', 'user_email')));
foreach ($users as $user) {
$return[] = array('label' => sprintf(__('%1$s (%2$s)'), $user->user_login, $user->user_email), 'value' => $user->{$field});
}
wp_die(wp_json_encode($return));
}
开发者ID:hughnet,项目名称:WordPress,代码行数:43,代码来源:ajax-actions.php
示例20: prepare_query
/**
* Prepare the query variables
*
* @since 3.1.0
* @access private
*/
function prepare_query()
{
global $wpdb;
$qv =& $this->query_vars;
if (is_array($qv['fields'])) {
$qv['fields'] = array_unique($qv['fields']);
$this->query_fields = array();
foreach ($qv['fields'] as $field) {
$this->query_fields[] = $wpdb->users . '.' . esc_sql($field);
}
$this->query_fields = implode(',', $this->query_fields);
} elseif ('all' == $qv['fields']) {
$this->query_fields = "{$wpdb->users}.*";
} else {
$this->query_fields = "{$wpdb->users}.ID";
}
if ($qv['count_total']) {
$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
}
$this->query_from = "FROM {$wpdb->users}";
$this->query_where = "WHERE 1=1";
// sorting
if (in_array($qv['orderby'], array('nicename', 'email', 'url', 'registered'))) {
$orderby = 'user_' . $qv['orderby'];
} elseif (in_array($qv['orderby'], array('user_nicename', 'user_email', 'user_url', 'user_registered'))) {
$orderby = $qv['orderby'];
} elseif ('name' == $qv['orderby'] || 'display_name' == $qv['orderby']) {
$orderby = 'display_name';
} elseif ('post_count' == $qv['orderby']) {
// todo: avoid the JOIN
$where = get_posts_by_author_sql('post');
$this->query_from .= " LEFT OUTER JOIN (\n\t\t\t\tSELECT post_author, COUNT(*) as post_count\n\t\t\t\tFROM {$wpdb->posts}\n\t\t\t\t{$where}\n\t\t\t\tGROUP BY post_author\n\t\t\t) p ON ({$wpdb->users}.ID = p.post_author)\n\t\t\t";
$orderby = 'post_count';
}
|
请发表评论