[ XREF Home ] [ Index ]

PHP Cross Reference of WordPress Trunk

Provided by Yoast

title

Body

[close]

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

Multi-site WordPress API

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

Defines 62 functions

  get_sitestats()
  get_admin_users_for_domain()
  get_active_blog_for_user()
  is_user_member_of_blog()
  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()
  wpmu_admin_do_redirect()
  wpmu_admin_redirect_add_updated_param()
  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_user_id_from_string()
  get_most_recent_post_of_user()
  get_dirsize()
  recurse_dirsize()
  upload_is_user_over_quota()
  check_upload_mimes()
  update_posts_count()
  wpmu_log_new_registrations()
  fix_import_form_size()
  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()
  get_dashboard_blog()
  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()

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 she has 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

is_user_member_of_blog( $user_id, $blog_id = 0 )   X-Ref
Find out whether a user is a member of a given blog.

param: int $user_id The unique ID of the user
param: int $blog Optional. If no blog_id is provided, current site is used
return: bool

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( $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 $id Optional. A site_id.
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: object The post.

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 $string The new blog's title.
param: int $site 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

wpmu_admin_do_redirect( $url = '' )   X-Ref
Redirect a user based on $_GET or $_POST arguments.

The function looks for redirect arguments in the following order:
1) $_GET['ref']
2) $_POST['ref']
3) $_SERVER['HTTP_REFERER']
4) $_GET['redirect']
5) $_POST['redirect']
6) $url

param: string $url

wpmu_admin_redirect_add_updated_param( $url = '' )   X-Ref
Adds an 'updated=true' argument to a URL.

param: string $url
return: string

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 = '')   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 = '')   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 = '')   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_email' 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: array $meta By default, contains the requested privacy setting and lang_id.
param: string $key The activation key created in wpmu_signup_blog()
return: bool

wpmu_signup_user_notification($user, $user_email, $key, $meta = '')   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: array $meta By default, an empty array.
param: string $key The activation key created in wpmu_signup_user()
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 = '', $site_id = 1)   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 = '')   X-Ref
Notify a user that her 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 = '')   X-Ref
Notify a user that her 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
of the site being viewed.

return: object

get_user_id_from_string( $string )   X-Ref
Get a numeric user ID from either an email address or a login.

param: string $string
return: int

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

upload_is_user_over_quota( $echo = true )   X-Ref
Check whether a blog has used its allotted upload space.

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

param: bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
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

fix_import_form_size( $size )   X-Ref
Get the remaining upload space for this blog.

param: int $size
return: int

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, $email, $meta )   X-Ref
Add a newly created user to the appropriate blog

param: int $user_id
param: string $email
param: array $meta

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


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

param: string $username
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

get_dashboard_blog()   X-Ref
Get the "dashboard blog", the blog where users without a blog edit their profile data.

return: int

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 an String URL to use HTTPS if HTTP is found.
Useful as a filter.


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.




Generated: Wed Jun 1 08:30:02 2011 Cross-referenced by PHPXref 0.7
Provided by Yoast and awesome WordPress Hosting