[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/ -> ms-functions.php (summary)

Multisite WordPress API

File Size: 2464 lines (78 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/includes/upgrade.php

Defines 66 functions

  get_sitestats()
  get_admin_users_for_domain()
  get_active_blog_for_user()
  get_user_count()
  get_blog_count()
  get_blog_post()
  add_user_to_blog()
  remove_user_from_blog()
  create_empty_blog()
  get_blog_permalink()
  get_blog_id_from_url()
  is_email_address_unsafe()
  wpmu_validate_user_signup()
  wpmu_validate_blog_signup()
  wpmu_signup_blog()
  wpmu_signup_user()
  wpmu_signup_blog_notification()
  wpmu_signup_user_notification()
  wpmu_activate_signup()
  wpmu_create_user()
  wpmu_create_blog()
  newblog_notify_siteadmin()
  newuser_notify_siteadmin()
  domain_exists()
  insert_blog()
  install_blog()
  install_blog_defaults()
  wpmu_welcome_notification()
  wpmu_welcome_user_notification()
  get_current_site()
  get_most_recent_post_of_user()
  get_dirsize()
  recurse_dirsize()
  check_upload_mimes()
  update_posts_count()
  wpmu_log_new_registrations()
  global_terms()
  redirect_this_site()
  upload_is_file_too_big()
  signup_nonce_fields()
  signup_nonce_check()
  maybe_redirect_404()
  maybe_add_existing_user_to_blog()
  add_existing_user_to_blog()
  add_new_user_to_blog()
  fix_phpmailer_messageid()
  is_user_spammy()
  update_blog_public()
  is_user_option_local()
  users_can_register_signup_filter()
  welcome_user_msg_filter()
  force_ssl_content()
  filter_SSL()
  wp_schedule_update_network_counts()
  wp_update_network_counts()
  wp_maybe_update_network_site_counts()
  wp_maybe_update_network_user_counts()
  wp_update_network_site_counts()
  wp_update_network_user_counts()
  get_space_used()
  get_space_allowed()
  get_upload_space_available()
  is_upload_space_available()
  upload_size_limit_filter()
  wp_is_large_network()
  wp_get_sites()

Functions
Functions that are not part of a class:

get_sitestats()   X-Ref
Gets the network's site and user counts.

return: array Site and user count for the network.

get_admin_users_for_domain( $sitedomain = '', $path = '' )   X-Ref
Get the admin for a domain/path combination.

param: string $sitedomain Optional. Site domain.
param: string $path Optional. Site path.
return: array The network admins

get_active_blog_for_user( $user_id )   X-Ref
Get one of a user's active blogs

Returns the user's primary blog, if they have one and
it is active. If it's inactive, function returns another
active blog of the user. If none are found, the user
is added as a Subscriber to the Dashboard Blog and that blog
is returned.

param: int $user_id The unique ID of the user
return: object The blog object

get_user_count()   X-Ref
The number of active users in your installation.

The count is cached and updated twice daily. This is not a live count.

return: int

get_blog_count( $network_id = 0 )   X-Ref
The number of active sites on your installation.

The count is cached and updated twice daily. This is not a live count.

param: int $network_id Deprecated, not supported.
return: int

get_blog_post( $blog_id, $post_id )   X-Ref
Get a blog post from any site on the network.

param: int $blog_id ID of the blog.
param: int $post_id ID of the post you're looking for.
return: WP_Post|null WP_Post on success or null on failure

add_user_to_blog( $blog_id, $user_id, $role )   X-Ref
Add a user to a blog.

Use the 'add_user_to_blog' action to fire an event when
users are added to a blog.

param: int $blog_id ID of the blog you're adding the user to.
param: int $user_id ID of the user you're adding.
param: string $role The role you want the user to have
return: bool

remove_user_from_blog($user_id, $blog_id = '', $reassign = '')   X-Ref
Remove a user from a blog.

Use the 'remove_user_from_blog' action to fire an event when
users are removed from a blog.

Accepts an optional $reassign parameter, if you want to
reassign the user's blog posts to another user upon removal.

param: int $user_id ID of the user you're removing.
param: int $blog_id ID of the blog you're removing the user from.
param: string $reassign Optional. A user to whom to reassign posts.
return: bool

create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 )   X-Ref
Create an empty blog.

param: string $domain The new blog's domain.
param: string $path The new blog's path.
param: string $weblog_title The new blog's title.
param: int $site_id Optional. Defaults to 1.
return: int The ID of the newly created blog

get_blog_permalink( $blog_id, $post_id )   X-Ref
Get the permalink for a post on another blog.

param: int $blog_id ID of the source blog.
param: int $post_id ID of the desired post.
return: string The post's permalink

get_blog_id_from_url( $domain, $path = '/' )   X-Ref
Get a blog's numeric ID from its URL.

On a subdirectory installation like example.com/blog1/,
$domain will be the root 'example.com' and $path the
subdirectory '/blog1/'. With subdomains like blog1.example.com,
$domain is 'blog1.example.com' and $path is '/'.

param: string $domain
param: string $path Optional. Not required for subdomain installations.
return: int 0 if no blog found, otherwise the ID of the matching blog

is_email_address_unsafe( $user_email )   X-Ref
Checks an email address against a list of banned domains.

This function checks against the Banned Email Domains list
at wp-admin/network/settings.php. The check is only run on
self-registrations; user creation at wp-admin/network/users.php
bypasses this check.

param: string $user_email The email provided by the user at registration.
return: bool Returns true when the email address is banned.

wpmu_validate_user_signup($user_name, $user_email)   X-Ref
Processes new user registrations.

Checks the data provided by the user during signup. Verifies
the validity and uniqueness of user names and user email addresses,
and checks email addresses against admin-provided domain
whitelists and blacklists.

The hook 'wpmu_validate_user_signup' provides an easy way
to modify the signup process. The value $result, which is passed
to the hook, contains both the user-provided info and the error
messages created by the function. 'wpmu_validate_user_signup' allows
you to process the data in any way you'd like, and unset the
relevant errors if necessary.

param: string $user_name The login name provided by the user.
param: string $user_email The email provided by the user.
return: array Contains username, email, and error messages.

wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' )   X-Ref
Processes new site registrations.

Checks the data provided by the user during blog signup. Verifies
the validity and uniqueness of blog paths and domains.

This function prevents the current user from registering a new site
with a blogname equivalent to another user's login name. Passing the
$user parameter to the function, where $user is the other user, is
effectively an override of this limitation.

Filter 'wpmu_validate_blog_signup' if you want to modify
the way that WordPress validates new site signups.

param: string $blogname The blog name provided by the user. Must be unique.
param: string $blog_title The blog title provided by the user.
return: array Contains the new site data and error messages.

wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array()   X-Ref
Record site signup information for future activation.

param: string $domain The requested domain.
param: string $path The requested path.
param: string $title The requested site title.
param: string $user The user's requested login name.
param: string $user_email The user's email address.
param: array $meta By default, contains the requested privacy setting and lang_id.

wpmu_signup_user( $user, $user_email, $meta = array()   X-Ref
Record user signup information for future activation.

This function is used when user registration is open but
new site registration is not.

param: string $user The user's requested login name.
param: string $user_email The user's email address.
param: array $meta By default, this is an empty array.

wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array()   X-Ref
Notify user of signup success.

This is the notification function used when site registration
is enabled.

Filter 'wpmu_signup_blog_notification' to bypass this function or
replace it with your own notification behavior.

Filter 'wpmu_signup_blog_notification_email' and
'wpmu_signup_blog_notification_subject' to change the content
and subject line of the email sent to newly registered users.

param: string $domain The new blog domain.
param: string $path The new blog path.
param: string $title The site title.
param: string $user The user's login name.
param: string $user_email The user's email address.
param: string $key The activation key created in wpmu_signup_blog()
param: array $meta By default, contains the requested privacy setting and lang_id.
return: bool

wpmu_signup_user_notification( $user, $user_email, $key, $meta = array()   X-Ref
Notify user of signup success.

This is the notification function used when no new site has
been requested.

Filter 'wpmu_signup_user_notification' to bypass this function or
replace it with your own notification behavior.

Filter 'wpmu_signup_user_notification_email' and
'wpmu_signup_user_notification_subject' to change the content
and subject line of the email sent to newly registered users.

param: string $user The user's login name.
param: string $user_email The user's email address.
param: string $key The activation key created in wpmu_signup_user()
param: array $meta By default, an empty array.
return: bool

wpmu_activate_signup($key)   X-Ref
Activate a signup.

Hook to 'wpmu_activate_user' or 'wpmu_activate_blog' for events
that should happen only when users or sites are self-created (since
those actions are not called when users and sites are created
by a Super Admin).

param: string $key The activation key provided to the user.
return: array An array containing information about the activated user and/or blog

wpmu_create_user( $user_name, $password, $email )   X-Ref
Create a user.

This function runs when a user self-registers as well as when
a Super Admin creates a new user. Hook to 'wpmu_new_user' for events
that should affect all new users, but only on Multisite (otherwise
use 'user_register').

param: string $user_name The new user's login name.
param: string $password The new user's password.
param: string $email The new user's email address.
return: mixed Returns false on failure, or int $user_id on success

wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array()   X-Ref
Create a site.

This function runs when a user self-registers a new site as well
as when a Super Admin creates a new site. Hook to 'wpmu_new_blog'
for events that should affect all new sites.

On subdirectory installs, $domain is the same as the main site's
domain, and the path is the subdirectory name (eg 'example.com'
and '/blog1/'). On subdomain installs, $domain is the new subdomain +
root domain (eg 'blog1.example.com'), and $path is '/'.

param: string $domain The new site's domain.
param: string $path The new site's path.
param: string $title The new site's title.
param: int $user_id The user ID of the new site's admin.
param: array $meta Optional. Used to set initial site options.
param: int $site_id Optional. Only relevant on multi-network installs.
return: mixed Returns WP_Error object on failure, int $blog_id on success

newblog_notify_siteadmin( $blog_id, $deprecated = '' )   X-Ref
Notifies the network admin that a new site has been activated.

Filter 'newblog_notify_siteadmin' to change the content of
the notification email.

param: int $blog_id The new site's ID.
return: bool

newuser_notify_siteadmin( $user_id )   X-Ref
Notifies the network admin that a new user has been activated.

Filter 'newuser_notify_siteadmin' to change the content of
the notification email.

param: int $user_id The new user's ID.
return: bool

domain_exists($domain, $path, $site_id = 1)   X-Ref
Check whether a blogname is already taken.

Used during the new site registration process to ensure
that each blogname is unique.

param: string $domain The domain to be checked.
param: string $path The path to be checked.
param: int $site_id Optional. Relevant only on multi-network installs.
return: int

insert_blog($domain, $path, $site_id)   X-Ref
Store basic site info in the blogs table.

This function creates a row in the wp_blogs table and returns
the new blog's ID. It is the first step in creating a new blog.

param: string $domain The domain of the new site.
param: string $path The path of the new site.
param: int $site_id Unless you're running a multi-network install, be sure to set this value to 1.
return: int The ID of the new row

install_blog( $blog_id, $blog_title = '' )   X-Ref
Install an empty blog.

Creates the new blog tables and options. If calling this function
directly, be sure to use switch_to_blog() first, so that $wpdb
points to the new blog.

param: int $blog_id The value returned by insert_blog().
param: string $blog_title The title of the new site.

install_blog_defaults($blog_id, $user_id)   X-Ref
Set blog defaults.

This function creates a row in the wp_blogs table.

param: int $blog_id Ignored in this function.
param: int $user_id

wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array()   X-Ref
Notify a user that their blog activation has been successful.

Filter 'wpmu_welcome_notification' to disable or bypass.

Filter 'update_welcome_email' and 'update_welcome_subject' to
modify the content and subject line of the notification email.

param: int $blog_id
param: int $user_id
param: string $password
param: string $title The new blog's title
param: array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
return: bool

wpmu_welcome_user_notification( $user_id, $password, $meta = array()   X-Ref
Notify a user that their account activation has been successful.

Filter 'wpmu_welcome_user_notification' to disable or bypass.

Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to
modify the content and subject line of the notification email.

param: int $user_id
param: string $password
param: array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
return: bool

get_current_site()   X-Ref
Get the current site info.

Returns an object containing the 'id', 'domain', 'path', and 'site_name'
properties of the site being viewed.

return: object

get_most_recent_post_of_user( $user_id )   X-Ref
Get a user's most recent post.

Walks through each of a user's blogs to find the post with
the most recent post_date_gmt.

param: int $user_id
return: array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts

get_dirsize( $directory )   X-Ref
Get the size of a directory.

A helper function that is used primarily to check whether
a blog has exceeded its allowed upload space.

param: string $directory
return: int

recurse_dirsize( $directory )   X-Ref
Get the size of a directory recursively.

Used by get_dirsize() to get a directory's size when it contains
other directories.

param: string $directory
return: int

check_upload_mimes( $mimes )   X-Ref
Check an array of MIME types against a whitelist.

WordPress ships with a set of allowed upload filetypes,
which is defined in wp-includes/functions.php in
get_allowed_mime_types(). This function is used to filter
that list against the filetype whitelist provided by Multisite
Super Admins at wp-admin/network/settings.php.

param: array $mimes
return: array

update_posts_count( $deprecated = '' )   X-Ref
Update a blog's post count.

WordPress MS stores a blog's post count as an option so as
to avoid extraneous COUNTs when a blog's details are fetched
with get_blog_details(). This function is called when posts
are published to make sure the count stays current.


wpmu_log_new_registrations( $blog_id, $user_id )   X-Ref
Logs user registrations.

param: int $blog_id
param: int $user_id

global_terms( $term_id, $deprecated = '' )   X-Ref
Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.

param: int $term_id An ID for a term on the current blog.
return: int An ID from the global terms table mapped from $term_id.

redirect_this_site( $deprecated = '' )   X-Ref
Ensure that the current site's domain is listed in the allowed redirect host list.

return: array The current site's domain

upload_is_file_too_big( $upload )   X-Ref
Check whether an upload is too big.

param: array $upload
return: mixed If the upload is under the size limit, $upload is returned. Otherwise returns an error message.

signup_nonce_fields()   X-Ref
Add a nonce field to the signup page.


signup_nonce_check( $result )   X-Ref
Process the signup nonce created in signup_nonce_fields().

param: array $result
return: array

maybe_redirect_404()   X-Ref
Correct 404 redirects when NOBLOGREDIRECT is defined.


maybe_add_existing_user_to_blog()   X-Ref
Add a new user to a blog by visiting /newbloguser/username/.

This will only work when the user's details are saved as an option
keyed as 'new_user_x', where 'x' is the username of the user to be
added, as when a user is invited through the regular WP Add User interface.


add_existing_user_to_blog( $details = false )   X-Ref
Add a user to a blog based on details from maybe_add_existing_user_to_blog().

param: array $details

add_new_user_to_blog( $user_id, $password, $meta )   X-Ref
Add a newly created user to the appropriate blog

To add a user in general, use add_user_to_blog(). This function
is specifically hooked into the wpmu_activate_user action.

param: int $user_id
param: mixed $password Ignored.
param: array $meta

fix_phpmailer_messageid( $phpmailer )   X-Ref
Correct From host on outgoing mail to match the site domain


is_user_spammy( $user = null )   X-Ref
Check to see whether a user is marked as a spammer, based on user login.

param: string|WP_User $user Optional. Defaults to current user. WP_User object,
return: bool

update_blog_public( $old_value, $value )   X-Ref
Update this blog's 'public' setting in the global blogs table.

Public blogs have a setting of 1, private blogs are 0.

param: int $old_value
param: int $value The new public value
return: bool

is_user_option_local( $key, $user_id = 0, $blog_id = 0 )   X-Ref
Check whether a usermeta key has to do with the current blog.

param: string $key
param: int $user_id Optional. Defaults to current user.
param: int $blog_id Optional. Defaults to current blog.
return: bool

users_can_register_signup_filter()   X-Ref
Check whether users can self-register, based on Network settings.

return: bool

welcome_user_msg_filter( $text )   X-Ref
Ensure that the welcome message is not empty. Currently unused.

param: string $text
return: string

force_ssl_content( $force = '' )   X-Ref
Whether to force SSL on content.

param: string|bool $force
return: bool True if forced, false if not forced.

filter_SSL( $url )   X-Ref
Formats a URL to use https.

Useful as a filter.

param: string URL
return: string URL with https as the scheme

wp_schedule_update_network_counts()   X-Ref
Schedule update of the network-wide counts for the current network.


wp_update_network_counts()   X-Ref
Update the network-wide counts for the current network.


wp_maybe_update_network_site_counts()   X-Ref
Update the count of sites for the current network.

If enabled through the 'enable_live_network_counts' filter, update the sites count
on a network when a site is created or its status is updated.


wp_maybe_update_network_user_counts()   X-Ref
Update the network-wide users count.

If enabled through the 'enable_live_network_counts' filter, update the users count
on a network when a user is created or its status is updated.


wp_update_network_site_counts()   X-Ref
Update the network-wide site count.


wp_update_network_user_counts()   X-Ref
Update the network-wide user count.


get_space_used()   X-Ref
Returns the space used by the current blog.

return: int Used space in megabytes

get_space_allowed()   X-Ref
Returns the upload quota for the current blog.

return: int Quota in megabytes

get_upload_space_available()   X-Ref
Determines if there is any upload space left in the current blog's quota.

return: int of upload space available in bytes

is_upload_space_available()   X-Ref
Determines if there is any upload space left in the current blog's quota.

return: bool True if space is available, false otherwise.

upload_size_limit_filter( $size )   X-Ref

return: int of upload size limit in bytes

wp_is_large_network( $using = 'sites' )   X-Ref
Whether or not we have a large network.

The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
Plugins can alter this criteria using the 'wp_is_large_network' filter.

param: string $using 'sites or 'users'. Default is 'sites'.
return: bool True if the network meets the criteria for large. False otherwise.

wp_get_sites( $args = array()   X-Ref
Return an array of sites for a network or networks.

param: array $args {
return: array An empty array if the install is considered "large" via wp_is_large_network(). Otherwise,



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu