welcome_user_msg_filter

函数
welcome_user_msg_filter ( $text )
参数
  • (string) $text
    Required:
返回值
  • (string)
定义位置
相关方法
wpmu_welcome_user_notificationdelete_user_metawp_resolve_numeric_slug_conflictswp_list_filtercore_update_footer
引入
-
弃用
-

welcome_user_msg_filter。这个过滤器用于定制新用户首次登录网站时显示的欢迎信息。它需要两个参数–$message和$user_id。$message是默认的欢迎词,$user_id是用户的ID。

确保欢迎词不是空的。目前未使用。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function welcome_user_msg_filter( $text ) {
if ( ! $text ) {
remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
/* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
$text = __(
'Howdy USERNAME,
Your new account is set up.
You can log in with the following information:
Username: USERNAME
Password: PASSWORD
LOGINLINK
Thanks!
--The Team @ SITE_NAME'
);
update_site_option( 'welcome_user_email', $text );
}
return $text;
}
function welcome_user_msg_filter( $text ) { if ( ! $text ) { remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' ); /* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */ $text = __( 'Howdy USERNAME, Your new account is set up. You can log in with the following information: Username: USERNAME Password: PASSWORD LOGINLINK Thanks! --The Team @ SITE_NAME' ); update_site_option( 'welcome_user_email', $text ); } return $text; }
function welcome_user_msg_filter( $text ) {
	if ( ! $text ) {
		remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );

		/* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
		$text = __(
			'Howdy USERNAME,

Your new account is set up.

You can log in with the following information:
Username: USERNAME
Password: PASSWORD
LOGINLINK

Thanks!

--The Team @ SITE_NAME'
		);
		update_site_option( 'welcome_user_email', $text );
	}
	return $text;
}

常见问题

FAQs
查看更多 >