function wppb_signup_user($username, $user_email, $meta = '')
{
    global $wpdb;
    // Format data
    $user = preg_replace('/\\s+/', '', sanitize_user($username, true));
    $user_email = sanitize_email($user_email);
    $activation_key = substr(md5(time() . rand() . $user_email), 0, 16);
    $meta = serialize($meta);
    if (is_multisite()) {
        $wpdb->insert($wpdb->signups, array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $activation_key, 'meta' => $meta));
    } else {
        $wpdb->insert($wpdb->prefix . 'signups', array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $activation_key, 'meta' => $meta));
    }
    do_action('wppb_signup_user', $username, $user_email, $activation_key, $meta);
    wppb_signup_user_notification($username, $user_email, $activation_key, $meta);
}
 function wppb_process_bulk_action()
 {
     global $current_user;
     global $wpdb;
     if (current_user_can('delete_users')) {
         if ('delete' === $this->current_action()) {
             foreach ($_GET['user'] as $user) {
                 $sql_result = $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", $user));
                 if (!$sql_result) {
                     $this->wppb_process_bulk_action_message(sprintf(__("%s couldn't be deleted", "profile-builder"), $result->user_login), get_bloginfo('url') . '/wp-admin/users.php?page=unconfirmed_emails');
                 }
             }
             $this->wppb_process_bulk_action_message(__('All users have been successfully deleted', 'profile-builder'), get_bloginfo('url') . '/wp-admin/users.php?page=unconfirmed_emails');
         } elseif ('confirm' === $this->current_action()) {
             foreach ($_GET['user'] as $user) {
                 $sql_result = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", $user), ARRAY_A);
                 if ($sql_result) {
                     wppb_manual_activate_signup($sql_result['activation_key']);
                 }
             }
             $this->wppb_process_bulk_action_message(__('The selected users have been activated', 'profile-builder'), get_bloginfo('url') . '/wp-admin/users.php?page=unconfirmed_emails');
         } elseif ('resend' === $this->current_action()) {
             foreach ($_GET['user'] as $user) {
                 $sql_result = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", $user), ARRAY_A);
                 if ($sql_result) {
                     wppb_signup_user_notification(esc_sql($sql_result['user_login']), esc_sql($sql_result['user_email']), $sql_result['activation_key'], $sql_result['meta']);
                 }
             }
             $this->wppb_process_bulk_action_message(__('The selected users have had their activation emails resent', 'profile-builder'), get_bloginfo('url') . '/wp-admin/users.php?page=unconfirmed_emails');
         }
     } else {
         $this->wppb_process_bulk_action_message(__("Sorry, but you don't have permission to do that!", "profile-builder"), get_bloginfo('url') . '/wp-admin/');
     }
 }
function wppb_signup_user($username, $user_email, $meta = '')
{
    global $wpdb;
    // Format data
    $user = sanitize_user($username, true);
    if (is_multisite()) {
        $user = preg_replace('/\\s+/', '', $user);
    }
    $user_email = sanitize_email($user_email);
    $activation_key = substr(md5(time() . rand() . $user_email), 0, 16);
    $meta = serialize($meta);
    // change User Registered date and time according to timezone selected in WordPress settings
    $wppb_get_date = wppb_get_date_by_timezone();
    if (isset($wppb_get_date)) {
        $wppb_user_registered = $wppb_get_date;
    } else {
        $wppb_user_registered = current_time('mysql', true);
    }
    if (is_multisite()) {
        $wpdb->insert($wpdb->signups, array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => $wppb_user_registered, 'activation_key' => $activation_key, 'meta' => $meta));
    } else {
        $wpdb->insert($wpdb->prefix . 'signups', array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => $wppb_user_registered, 'activation_key' => $activation_key, 'meta' => $meta));
    }
    do_action('wppb_signup_user', $username, $user_email, $activation_key, $meta);
    wppb_signup_user_notification($username, $user_email, $activation_key, $meta);
}