Esempio n. 1
0
 /**
  * Resends an activation email
  *
  * This sends exactly the same email the registrant originally got, using data pulled from
  * their registration. In the future I may add a UI for customized emails.
  *
  * @package Unconfirmed
  * @since 1.0
  *
  * @uses wpmu_signup_blog_notification() to notify users who signed up with a blog
  * @uses wpmu_signup_user_notification() to notify users who signed up without a blog
  */
 function resend_email()
 {
     global $wpdb;
     // Hubba hubba
     if (isset($_REQUEST['unconfirmed_bulk'])) {
         check_admin_referer('unconfirmed_bulk_action');
     } else {
         check_admin_referer('unconfirmed_resend_email');
     }
     // Get the user's activation key out of the URL params
     if (!isset($_REQUEST['unconfirmed_key'])) {
         $this->record_status('error_nokey');
         return;
     }
     $resent_counts = get_site_option('unconfirmed_resent_counts');
     $keys = $_REQUEST['unconfirmed_key'];
     foreach ((array) $keys as $key) {
         if ($this->is_multisite) {
             $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->signups} WHERE activation_key = %s", $key));
         } else {
             $user = $this->get_userdata_from_key($key);
         }
         if (!$user) {
             $this->record_status('error_nouser', $key);
             continue;
         }
         if ($this->is_multisite) {
             // We use a different email function depending on whether they registered with blog
             if (!empty($user->domain)) {
                 wpmu_signup_blog_notification($user->domain, $user->path, $user->title, $user->user_login, $user->user_email, $user->activation_key, maybe_unserialize($user->meta));
             } else {
                 wpmu_signup_user_notification($user->user_login, $user->user_email, $user->activation_key, maybe_unserialize($user->meta));
             }
         } else {
             // If you're running BP on a non-multisite instance of WP, use the
             // BP function to send the email
             if (function_exists('bp_core_signup_send_validation_email')) {
                 bp_core_signup_send_validation_email($user->ID, $user->user_email, $key);
             }
         }
         if (isset($resent_counts[$key])) {
             $resent_counts[$key] = $resent_counts[$key] + 1;
         } else {
             $resent_counts[$key] = 1;
         }
         // I can't do a true/false check on whether the email was sent because of
         // the crappy way that WPMU and BP work together to send these messages
         // See bp_core_activation_signup_user_notification()
         $this->record_status('updated_resent', $key);
     }
     update_site_option('unconfirmed_resent_counts', $resent_counts);
 }
Esempio n. 2
0
/**
 * Record site signup information for future activation.
 *
 * @since MU
 * @uses wpmu_signup_blog_notification()
 *
 * @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.
 */
function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = '')
{
    global $wpdb;
    $key = substr(md5(time() . rand() . $domain), 0, 16);
    $meta = serialize($meta);
    $domain = $wpdb->escape($domain);
    $path = $wpdb->escape($path);
    $title = $wpdb->escape($title);
    $wpdb->insert($wpdb->signups, array('domain' => $domain, 'path' => $path, 'title' => $title, 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta));
    wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta);
}
Esempio n. 3
0
function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = '')
{
    global $wpdb;
    $key = substr(md5(time() . rand() . $domain), 0, 16);
    $registered = current_time('mysql', true);
    $meta = serialize($meta);
    $domain = $wpdb->escape($domain);
    $path = $wpdb->escape($path);
    $title = $wpdb->escape($title);
    $wpdb->query("INSERT INTO {$wpdb->signups} ( domain, path, title, user_login, user_email, registered, activation_key, meta )\n\t\t\t\t\tVALUES ( '{$domain}', '{$path}', '{$title}', '{$user}', '{$user_email}', '{$registered}', '{$key}', '{$meta}' )");
    wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta);
}