function simplr_resend_email($id)
 {
     global $simplr_options, $blog_id;
     $data = (array) get_userdata($id);
     $data = (array) $data['data'];
     $data['blogname'] = get_option('blogname');
     $subj = simplr_token_replace($simplr_options->mod_email_subj, $data);
     $content = simplr_token_replace($simplr_options->mod_email, $data);
     $content = simplr_token_replace($content, array('link' => get_home_url($blog_id, '/?activation_key=' . $data['user_activation_key'])));
     if (isset($simplr_options->default_email)) {
         $from = $simplr_options->default_email;
     } else {
         $from = get_option('admin_email');
     }
     $headers = "From: " . $data['blogname'] . " <" . $from . "> \r\n";
     wp_mail($data['user_email'], $subj, $content, $headers);
 }
function simplr_activate_users($ids = false)
{
    if (!$ids) {
        if (@$_REQUEST['action'] == 'sreg-activate-selected' and !empty($_REQUEST['users'])) {
            simplr_activate_users($_REQUEST['users']);
        }
    } else {
        global $wpdb, $simplr_options;
        foreach ($ids as $id) {
            $return = $wpdb->update($wpdb->users, array('user_status' => 0), array('ID' => $id), array('%d'), array('%d'));
            if (!$return) {
                return new WP_Error("error", __("Could not activate requested user.", 'simplr-registration-form'));
            }
            $userdata = get_userdata($id);
            $data = (array) $userdata;
            $data = (array) $data['data'];
            $data['blogname'] = get_option('blogname');
            $data['username'] = $userdata->user_login;
            do_action('simplr_activated_user', $data);
            $subj = simplr_token_replace($simplr_options->mod_email_activated_subj, $data);
            $content = simplr_token_replace($simplr_options->mod_email_activated, $data);
            if (isset($simplr_options->default_email)) {
                $from = $simplr_options->default_email;
            } else {
                $from = get_option('admin_email');
            }
            $headers = "From: " . $data['blogname'] . " <{$from}>\r\n";
            wp_mail($data['user_email'], $subj, $content, $headers);
            return $return;
        }
    }
}
function simplr_token_replace($content, $data)
{
    global $blog_id;
    foreach ($data as $k => $v) {
        if (is_array($v) or is_object($v)) {
            simplr_token_replace($content, (array) $v);
        }
        if (!is_array($v)) {
            $content = str_replace("%%{$k}%%", $v, $content);
        }
    }
    return $content;
}