<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25481] trunk/src/wp-admin/includes/ms.php: Inline documentation for hooks in wp-admin/includes/ms.php.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25481">25481</a></dd>
<dt>Author</dt> <dd>SergeyBiryukov</dd>
<dt>Date</dt> <dd>2013-09-18 18:21:46 +0000 (Wed, 18 Sep 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-admin/includes/ms.php.
props enej, DrewAPicture.
see <a href="http://core.trac.wordpress.org/ticket/25229">#25229</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesmsphp">trunk/src/wp-admin/includes/ms.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/ms.php (25480 => 25481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/ms.php 2013-09-18 17:30:23 UTC (rev 25480)
+++ trunk/src/wp-admin/includes/ms.php 2013-09-18 18:21:46 UTC (rev 25481)
</span><span class="lines">@@ -61,7 +61,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $blog = get_blog_details( $blog_id );
</span><del>-
</del><ins>+ /**
+ * Fires before a blog is deleted.
+ *
+ * @since MU
+ *
+ * @param int $blog_id The blog ID.
+ * @param bool $drop True if blog's table should be dropped. Default is false.
+ */
</ins><span class="cx"> do_action( 'delete_blog', $blog_id, $drop );
</span><span class="cx">
</span><span class="cx"> $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
</span><span class="lines">@@ -80,7 +87,16 @@
</span><span class="cx"> $drop = false;
</span><span class="cx">
</span><span class="cx"> if ( $drop ) {
</span><del>- $drop_tables = apply_filters( 'wpmu_drop_tables', $wpdb->tables( 'blog' ), $blog_id );
</del><ins>+ $tables = $wpdb->tables( 'blog' );
+ /**
+ * Filter the tables to drop when the blog is deleted.
+ *
+ * @since MU
+ *
+ * @param array $tables The blog tables to be dropped.
+ * @param int $blog_id The ID of the blog to drop tables for.
+ */
+ $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
</ins><span class="cx">
</span><span class="cx"> foreach ( (array) $drop_tables as $table ) {
</span><span class="cx"> $wpdb->query( "DROP TABLE IF EXISTS `$table`" );
</span><span class="lines">@@ -89,6 +105,14 @@
</span><span class="cx"> $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
</span><span class="cx">
</span><span class="cx"> $uploads = wp_upload_dir();
</span><ins>+ /**
+ * Filter the upload base directory to delete when the blog is deleted.
+ *
+ * @since MU
+ *
+ * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
+ * @param int $blog_id The blog ID.
+ */
</ins><span class="cx"> $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
</span><span class="cx"> $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
</span><span class="cx"> $top_dir = $dir;
</span><span class="lines">@@ -137,7 +161,13 @@
</span><span class="cx">
</span><span class="cx"> if ( !$user->exists() )
</span><span class="cx"> return false;
</span><del>-
</del><ins>+ /**
+ * Fires when a user is deleted from the network.
+ *
+ * @since MU
+ *
+ * @param int $id User ID of the user about to be deleted from the network.
+ */
</ins><span class="cx"> do_action( 'wpmu_delete_user', $id );
</span><span class="cx">
</span><span class="cx"> $blogs = get_blogs_of_user( $id );
</span><span class="lines">@@ -172,7 +202,13 @@
</span><span class="cx">
</span><span class="cx"> clean_user_cache( $user );
</span><span class="cx">
</span><del>- // allow for commit transaction
</del><ins>+ /**
+ * Fires after the user is deleted from the network.
+ *
+ * @since 2.8.0
+ *
+ * @param int $id User ID of the user about to be deleted from the network.
+ */
</ins><span class="cx"> do_action( 'deleted_user', $id );
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="lines">@@ -190,7 +226,7 @@
</span><span class="cx"> );
</span><span class="cx"> update_option( 'adminhash', $new_admin_email );
</span><span class="cx">
</span><del>- $content = apply_filters( 'new_admin_email_content', __( "Dear user,
</del><ins>+ $email_text = __( 'Dear user,
</ins><span class="cx">
</span><span class="cx"> You recently requested to have the administration email address on
</span><span class="cx"> your site changed.
</span><span class="lines">@@ -204,8 +240,24 @@
</span><span class="cx">
</span><span class="cx"> Regards,
</span><span class="cx"> All at ###SITENAME###
</span><del>-###SITEURL### "), $new_admin_email );
</del><ins>+###SITEURL###' );
</ins><span class="cx">
</span><ins>+ /**
+ * Filter the email text sent when the site admin email is changed.
+ *
+ * The following strings have a special meaning and will get replaced dynamically:
+ * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
+ * ###EMAIL### The new email.
+ * ###SITENAME### The name of the site.
+ * ###SITEURL### The URL to the site.
+ *
+ * @since MU
+ *
+ * @param string $email_text Text in the email.
+ * @param string $new_admin_email New admin email that the current administration email was changed to.
+ */
+ $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
+
</ins><span class="cx"> $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
</span><span class="cx"> $content = str_replace( '###EMAIL###', $value, $content );
</span><span class="cx"> $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
</span><span class="lines">@@ -243,9 +295,9 @@
</span><span class="cx"> 'newemail' => $_POST['email']
</span><span class="cx"> );
</span><span class="cx"> update_option( $current_user->ID . '_new_email', $new_user_email );
</span><ins>+
+ $email_text = __( 'Dear user,
</ins><span class="cx">
</span><del>- $content = apply_filters( 'new_user_email_content', __( "Dear user,
-
</del><span class="cx"> You recently requested to have the email address on your account changed.
</span><span class="cx"> If this is correct, please click on the following link to change it:
</span><span class="cx"> ###ADMIN_URL###
</span><span class="lines">@@ -257,8 +309,24 @@
</span><span class="cx">
</span><span class="cx"> Regards,
</span><span class="cx"> All at ###SITENAME###
</span><del>-###SITEURL###" ), $new_user_email );
</del><ins>+###SITEURL###' );
</ins><span class="cx">
</span><ins>+ /**
+ * Filter the email text sent when a user changes emails.
+ *
+ * The following strings have a special meaning and will get replaced dynamically:
+ * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
+ * ###EMAIL### The new email.
+ * ###SITENAME### The name of the site.
+ * ###SITEURL### The URL to the site.
+ *
+ * @since MU
+ *
+ * @param string $email_text Text in the email.
+ * @param string $new_user_email New user email that the current user has changed to.
+ */
+ $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
+
</ins><span class="cx"> $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
</span><span class="cx"> $content = str_replace( '###EMAIL###', $_POST['email'], $content);
</span><span class="cx"> $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
</span><span class="lines">@@ -377,10 +445,25 @@
</span><span class="cx"> clean_user_cache( $user );
</span><span class="cx">
</span><span class="cx"> if ( $pref == 'spam' ) {
</span><del>- if ( $value == 1 )
</del><ins>+ if ( $value == 1 ) {
+ /**
+ * Fires when the user is marked as a SPAM user.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id User ID of the user marked as SPAM.
+ */
</ins><span class="cx"> do_action( 'make_spam_user', $id );
</span><del>- else
</del><ins>+ } else {
+ /**
+ * Fires when the user is marked as a HAM user. Opposite of SPAM.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id User ID of the user marked as HAM.
+ */
</ins><span class="cx"> do_action( 'make_ham_user', $id );
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return $value;
</span><span class="lines">@@ -411,6 +494,15 @@
</span><span class="cx"> 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
</span><span class="cx"> 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
</span><span class="cx"> 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
</span><ins>+
+ /**
+ * Filter the language codes.
+ *
+ * @since MU
+ *
+ * @param array $lang_codes Key/value pair of language codes where key is the short version.
+ * @param string $code A two-letter designation of the language.
+ */
</ins><span class="cx"> $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
</span><span class="cx"> return strtr( $code, $lang_codes );
</span><span class="cx"> }
</span><span class="lines">@@ -498,7 +590,15 @@
</span><span class="cx">
</span><span class="cx"> // Order by name
</span><span class="cx"> uksort( $output, 'strnatcasecmp' );
</span><del>-
</del><ins>+ /**
+ * Filter the languages available in the dropdown.
+ *
+ * @since MU
+ *
+ * @param array $output HTML output of the dropdown.
+ * @param array $lang_files Available language files.
+ * @param string $current The current language code.
+ */
</ins><span class="cx"> $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
</span><span class="cx"> echo implode( "\n\t", $output );
</span><span class="cx"> }
</span><span class="lines">@@ -575,7 +675,17 @@
</span><span class="cx"> <?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?>
</span><span class="cx"> <tr>
</span><span class="cx"> <th scope="row" colspan="2" class="th-full">
</span><del>- <a href="<?php echo apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a>
</del><ins>+ <?php
+ $signup_url = network_site_url( 'wp-signup.php' );
+ /**
+ * Filter the site signup URL.
+ *
+ * @since MU
+ *
+ * @param string $signup_url The site signup URL.
+ */
+ ?>
+ <a href="<?php echo apply_filters( 'wp_signup_location', $signup_url ); ?>"><?php _e( 'Create a New Site' ); ?></a>
</ins><span class="cx"> </th>
</span><span class="cx"> </tr>
</span><span class="cx"> <?php endif; ?>
</span><span class="lines">@@ -595,7 +705,14 @@
</span><span class="cx"> // If global super_admins override is defined, there is nothing to do here.
</span><span class="cx"> if ( isset($super_admins) )
</span><span class="cx"> return false;
</span><del>-
</del><ins>+
+ /**
+ * Fires before the user is granted Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id User ID of the user is granted Super Admin privileges.
+ */
</ins><span class="cx"> do_action( 'grant_super_admin', $user_id );
</span><span class="cx">
</span><span class="cx"> // Directly fetch site_admins instead of using get_super_admins()
</span><span class="lines">@@ -605,6 +722,14 @@
</span><span class="cx"> if ( $user && ! in_array( $user->user_login, $super_admins ) ) {
</span><span class="cx"> $super_admins[] = $user->user_login;
</span><span class="cx"> update_site_option( 'site_admins' , $super_admins );
</span><ins>+
+ /**
+ * Fires after the user is granted Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id User ID of the user is granted Super Admin privileges.
+ */
</ins><span class="cx"> do_action( 'granted_super_admin', $user_id );
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -623,7 +748,13 @@
</span><span class="cx"> // If global super_admins override is defined, there is nothing to do here.
</span><span class="cx"> if ( isset($super_admins) )
</span><span class="cx"> return false;
</span><del>-
</del><ins>+ /**
+ * Fires before the user's Super Admin privileges are revoked.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id User ID of the user Super Admin privileges are being revoked from.
+ */
</ins><span class="cx"> do_action( 'revoke_super_admin', $user_id );
</span><span class="cx">
</span><span class="cx"> // Directly fetch site_admins instead of using get_super_admins()
</span><span class="lines">@@ -634,6 +765,14 @@
</span><span class="cx"> if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) {
</span><span class="cx"> unset( $super_admins[$key] );
</span><span class="cx"> update_site_option( 'site_admins', $super_admins );
</span><ins>+
+ /**
+ * Fires after the user's Super Admin privileges are revoked.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id User ID of the user Super Admin privileges were revoked from.
+ */
</ins><span class="cx"> do_action( 'revoked_super_admin', $user_id );
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -647,7 +786,7 @@
</span><span class="cx"> * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden
</span><span class="cx"> *
</span><span class="cx"> * @since 3.1.0
</span><del>- * @param integer $site_id The network/site id to check.
</del><ins>+ * @param integer $site_id The network/site ID to check.
</ins><span class="cx"> */
</span><span class="cx"> function can_edit_network( $site_id ) {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -656,7 +795,14 @@
</span><span class="cx"> $result = true;
</span><span class="cx"> else
</span><span class="cx"> $result = false;
</span><del>-
</del><ins>+ /**
+ * Filter whether this network can be edited from this page.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $result Whether the network can be edited from this page.
+ * @param int $site_id The network/site ID to check.
+ */
</ins><span class="cx"> return apply_filters( 'can_edit_network', $result, $site_id );
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>