示例#1
0
    } else {
        // Adding a new user to this blog
        $user_details = nxtmu_validate_user_signup($_REQUEST['user_login'], $_REQUEST['email']);
        unset($user_details['errors']->errors['user_email_used']);
        if (is_nxt_error($user_details['errors']) && !empty($user_details['errors']->errors)) {
            $add_user_errors = $user_details['errors'];
        } else {
            $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
            if (isset($_POST['noconfirmation']) && is_super_admin()) {
                add_filter('nxtmu_signup_user_notification', '__return_false');
                // Disable confirmation email
            }
            nxtmu_signup_user($new_user_login, $_REQUEST['email'], array('add_to_blog' => $nxtdb->blogid, 'new_role' => $_REQUEST['role']));
            if (isset($_POST['noconfirmation']) && is_super_admin()) {
                $key = $nxtdb->get_var($nxtdb->prepare("SELECT activation_key FROM {$nxtdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST['email']));
                nxtmu_activate_signup($key);
                $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
            } else {
                $redirect = add_query_arg(array('update' => 'newuserconfimation'), 'user-new.php');
            }
            nxt_redirect($redirect);
            die;
        }
    }
}
$title = __('Add New User');
$parent_file = 'users.php';
$do_both = false;
if (is_multisite() && current_user_can('promote_users') && current_user_can('create_users')) {
    $do_both = true;
}
示例#2
0
function bp_core_activate_signup($key)
{
    global $bp, $nxtdb;
    $user = false;
    // Multisite installs have their own activation routine
    if (is_multisite()) {
        $user = nxtmu_activate_signup($key);
        // If there were errors, add a message and redirect
        if (!empty($user->errors)) {
            return $user;
        }
        $user_id = $user['user_id'];
        // Set any profile data
        if (bp_is_active('xprofile')) {
            if (!empty($user['meta']['profile_field_ids'])) {
                $profile_field_ids = explode(',', $user['meta']['profile_field_ids']);
                foreach ((array) $profile_field_ids as $field_id) {
                    $current_field = isset($user['meta']["field_{$field_id}"]) ? $user['meta']["field_{$field_id}"] : false;
                    if (!empty($current_field)) {
                        xprofile_set_field_data($field_id, $user_id, $current_field);
                    }
                }
            }
        }
    } else {
        // Get the user_id based on the $key
        $user_id = $nxtdb->get_var($nxtdb->prepare("SELECT user_id FROM {$nxtdb->usermeta} WHERE meta_key = 'activation_key' AND meta_value = %s", $key));
        if (empty($user_id)) {
            return new nxt_Error('invalid_key', __('Invalid activation key', 'buddypress'));
        }
        // Change the user's status so they become active
        if (!$nxtdb->query($nxtdb->prepare("UPDATE {$nxtdb->users} SET user_status = 0 WHERE ID = %d", $user_id))) {
            return new nxt_Error('invalid_key', __('Invalid activation key', 'buddypress'));
        }
        // Notify the site admin of a new user registration
        nxt_new_user_notification($user_id);
        // Remove the activation key meta
        delete_user_meta($user_id, 'activation_key');
    }
    // Update the display_name
    nxt_update_user(array('ID' => $user_id, 'display_name' => bp_core_get_user_displayname($user_id)));
    // Set the password on multisite installs
    if (is_multisite() && !empty($user['meta']['password'])) {
        $nxtdb->query($nxtdb->prepare("UPDATE {$nxtdb->users} SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id));
    }
    // Delete the total member cache
    nxt_cache_delete('bp_total_member_count', 'bp');
    do_action('bp_core_activated_user', $user_id, $key, $user);
    return $user_id;
}
示例#3
0
    ?>
</label>
			    <br /><input type="text" name="key" id="key" value="" size="50" />
			</p>
			<p class="submit">
			    <input id="submit" type="submit" name="Submit" class="submit" value="<?php 
    esc_attr_e('Activate');
    ?>
" />
			</p>
		</form>

	<?php 
} else {
    $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
    $result = nxtmu_activate_signup($key);
    if (is_nxt_error($result)) {
        if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) {
            $signup = $result->get_error_data();
            ?>
				<h2><?php 
            _e('Your account is now active!');
            ?>
</h2>
				<?php 
            echo '<p class="lead-in">';
            if ($signup->domain . $signup->path == '') {
                printf(__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;.  Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url('nxt-login.php', 'login'), $signup->user_login, $signup->user_email, nxt_lostpassword_url());
            } else {
                printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;.  Please check your email inbox at %4$s for your password and login instructions.  If you do not receive an email, please check your junk or spam folder.  If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, nxt_lostpassword_url());
            }