Skip to content
Snippets Groups Projects
Commit 42d2d22c authored by Tim Steiner's avatar Tim Steiner
Browse files

Send an email to a user when they create a new blog.

parent a5fb3fc1
No related branches found
No related tags found
No related merge requests found
...@@ -119,9 +119,49 @@ function unl_new_blog($blogId) ...@@ -119,9 +119,49 @@ function unl_new_blog($blogId)
{ {
switch_to_blog($blogId); switch_to_blog($blogId);
switch_theme('unl_modern', 'unl_modern'); switch_theme('unl_modern', 'unl_modern');
unl_new_blog_notification($blogId);
restore_current_blog(); restore_current_blog();
} }
function unl_new_blog_notification($blogId)
{
$welcomeEmail =
'Your new SITE_NAME blog has been successfully set up at:
BLOG_URL
You can log in to the administrator account with your My.UNL account
Login Here: BLOG_URLwp-admin/
We hope you enjoy your new weblog.
Thanks!
--The WordPress Team
SITE_NAME';
$url = get_blogaddress_by_id($blogId);
$user = wp_get_current_user();
$title = get_bloginfo('title');
$currentSite = $GLOBALS['current_site'];
$welcomeEmail = str_replace( "SITE_NAME", $currentSite->site_name, $welcomeEmail );
$welcomeEmail = str_replace( "BLOG_TITLE", $title, $welcomeEmail );
$welcomeEmail = str_replace( "BLOG_URL", $url, $welcomeEmail );
$admin_email = get_site_option( "admin_email" );
if( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcomeEmail;
if( empty( $current_site->site_name ) )
$currentSite->site_name = "WordPress MU";
$subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Blog: %2$s'), $currentSite->site_name, stripslashes( $title ) ) );
wp_mail($user->user_email, $subject, $message, $message_headers);
return true;
}
add_action('set_current_user', 'unl_set_current_user', 0); add_action('set_current_user', 'unl_set_current_user', 0);
add_action('plugins_loaded', 'unl_init'); add_action('plugins_loaded', 'unl_init');
add_action('auth_redirect', 'unl_auth_redirect'); add_action('auth_redirect', 'unl_auth_redirect');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment