confirm_blog_signup()
概述
confirm_blog_signup() 函数用于显示新站点注册成功并等待激活的确认消息。它处理多站点网络中的站点注册流程,输出用户友好的界面信息。
关键要点
- 函数作用:显示新站点注册确认消息,告知用户站点已创建但需激活。
- 参数说明:接受 $domain(域名)、$path(路径)、$blog_title(站点标题)、$user_name(用户名)、$user_email(用户邮箱)和 $meta(可选元数据数组)。
- 输出内容:包含站点标题、激活链接和用户邮箱信息,使用 __() 和 _e() 进行国际化处理。
- Hook 触发:在 signup_finished 动作钩子中触发,表示站点或用户注册过程完成。
- 相关函数:与 validate_blog_signup() 配合使用,用于验证站点注册信息。
- 版本历史:自 WordPress MU 3.0.0 版本引入,适用于多站点环境。
代码示例
function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
// 显示确认消息的代码逻辑
// 例如:输出站点标题和激活提示
}注意事项
此函数主要用于多站点(Multisite)环境,确保在正确上下文中调用以避免错误。参数 $meta 可选,默认值为空数组,来自 validate_blog_signup() 中的 'add_signup_meta' 过滤器。
Shows a message confirming that the new site has been registered and is awaiting activation.
Parameters
$domainstringrequired-
The domain or subdomain of the site.
$pathstringrequired-
The path of the site.
$blog_titlestringrequired-
The title of the new site.
$user_namestringrequired-
The user’s username.
$user_emailstringrequired-
The user’s email address.
$metaarrayoptional-
Any additional meta from the ‘add_signup_meta’ filter in validate_blog_signup() .
Default:
array()
Source
function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
?>
<h2>
{$blog_title}</a>" )
?>
</h2>
<p>you must activate it</strong>.' ); ?></p>
<p>
' . $user_email . '</strong>' );
?>
</p>
<p></p>
<h2></h2>
<p></p>
<ul id="noemail-tips">
<li><p><strong></strong></p></li>
<li><p></p></li>
<li>
</li>
</ul>
</pre><p class="wporg-dot-link-list"><a href="https://developer.wordpress.org/reference/files/wp-signup.php/">View all references</a> <a href="https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-signup.php#L860">View on Trac</a> <a href="https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-signup.php#L860-L892">View on GitHub</a></p></section>
<section class="wp-block-wporg-code-reference-hooks"><h2 id="hooks" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#hooks">Hooks</a></h2> <dl><dt class="wp-block-wporg-code-reference-title has-normal-font-size"><a href="https://developer.wordpress.org/reference/hooks/signup_finished/"><span class="hook-func">do_action</span>( ‘signup_finished’ )</a></dt><dd><p>Fires when the site or user sign-up process is complete.</p>
</dd></dl></section>
<section class="wp-block-wporg-code-reference-related" data-nosnippet="true"><h2 id="related" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#related">Related</a></h2> <section style="margin-top:var(--wp--preset--spacing--20)" class="wp-block-wporg-code-table" id="uses"><figure class="wp-block-table "><table><thead><tr><th scope="col">Uses</th><th scope="col">Description</th></tr></thead><tbody><tr class=""><td><a href="https://developer.wordpress.org/reference/functions/__/">__()</a><code>wp-includes/l10n.php
Retrieves the translation of $text.
_e()wp-includes/l10n.php
Displays translated text.
do_action()wp-includes/plugin.php
Calls the callback functions that have been added to an action hook.
| Used by | Description |
|---|---|
validate_blog_signup()wp-signup.php |
Validates new site signup. |
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |