当前位置: 首页>>代码示例>>PHP>>正文


PHP wpmu_activate_signup函数代码示例

本文整理汇总了PHP中wpmu_activate_signup函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmu_activate_signup函数的具体用法?PHP wpmu_activate_signup怎么用?PHP wpmu_activate_signup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpmu_activate_signup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: psu_signup_blog_notification

function psu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta)
{
    $activated = wpmu_activate_signup($key);
    if (is_array($activated) && $activated['blog_id'] && $activated['user_id']) {
        // successfully created blog
        update_blog_option($activated['blog_id'], 'stylesheet', 'pressrow');
        update_blog_option($activated['blog_id'], 'template', 'pressrow');
        // they're already CAS authenticated,
        // so set the WP authentication cookie for them
        wp_set_auth_cookie($activated['user_id']);
        ?>

		<h2>Yay! We made a blog for you</h2>
		<p>Click this link to access your dashboard:</p>
		<ul><li><a href="http://<?php 
        echo $domain . $path;
        ?>
wp-admin/"><?php 
        echo $domain . $path;
        ?>
wp-admin/</a></li></ul>
		<p>Go ahead and bookmark it once you get there, we hope you come back.</p><?php 
    } else {
        // error will robinson
        ?>
		<h2>hrrm...</h2>
		<p>There seems to have been an error.</p>
		<p>You may already have a blog at this address: <a href="http://<?php 
        echo $domain . $path;
        ?>
" target="_blank"><?php 
        echo $domain . $path;
        ?>
</a>.</p>
		<p>Please call the <a href="http://url.path.to/your/helpdesk" target="_blank">Help Desk</a> with the following:</p>
		<p><pre><?php 
        print_r($activated->errors);
        ?>
</pre></p><?php 
    }
    return FALSE;
}
开发者ID:syntagma,项目名称:wpcas,代码行数:42,代码来源:provisioning_example.php

示例2: aiowps_login_init

 function aiowps_login_init()
 {
     if (strpos($_SERVER['REQUEST_URI'], 'wp-login') !== false) {
         $referer = wp_get_referer();
         if ($referer && strpos($referer, 'wp-activate.php') !== false) {
             $parsed_referer = parse_url($referer);
             if ($parsed_referer && !empty($parsed_referer['query'])) {
                 parse_str($parsed_referer['query'], $referer);
                 if (!empty($parsed_referer['key'])) {
                     $result = wpmu_activate_signup($parsed_referer['key']);
                     //MS site creation
                     if ($result && is_wp_error($result) && ($result->get_error_code() === 'already_active' || $result->get_error_code() === 'blog_taken')) {
                         $aiowps_new_login_url = AIOWPSecurity_Process_Renamed_Login_Page::new_login_url();
                         wp_safe_redirect($aiowps_new_login_url . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
                         die;
                     }
                 }
             }
         }
         AIOWPSecurity_Process_Renamed_Login_Page::aiowps_set_404();
     }
 }
开发者ID:Rudchyk,项目名称:wp-framework,代码行数:22,代码来源:wp-security-process-renamed-login-page.php

示例3: uf_perform_activation

/**
 * Activates a user if it is necessary
 *
 * @wp-hook	uf_activation
 * @return	void
 */
function uf_perform_activation()
{
    if (!isset($_POST['user_key'])) {
        wp_safe_redirect(home_url('/user-activation/?message=keynotvalid'));
        exit;
    } else {
        $key = $_POST['user_key'];
        $result = wpmu_activate_signup($key);
        if (is_wp_error($result)) {
            wp_safe_redirect(home_url('/user-activation/?message=keynotvalid'));
            exit;
        } else {
            $user = get_userdata($result['user_id']);
            $username = $user->user_login;
            $password = $result['password'];
            // set credentials
            $credentials = array('user_login' => $username, 'user_password' => $password);
            // signon user
            $user = wp_signon($credentials);
            wp_safe_redirect(home_url('/user-profile/?message=activated'));
            exit;
        }
    }
}
开发者ID:WordImpress,项目名称:User-Frontend,代码行数:30,代码来源:action-activation.php

示例4: bp_core_activate_signup

/**
 * Activate a signup, as identified by an activation key.
 *
 * @since 1.2.2
 *
 * @param string $key Activation key.
 * @return int|bool User ID on success, false on failure.
 */
function bp_core_activate_signup($key)
{
    global $wpdb;
    $user = false;
    // Multisite installs have their own activation routine.
    if (is_multisite()) {
        $user = wpmu_activate_signup($key);
        // If there were errors, add a message and redirect.
        if (!empty($user->errors)) {
            return $user;
        }
        $user_id = $user['user_id'];
    } else {
        $signups = BP_Signup::get(array('activation_key' => $key));
        if (empty($signups['signups'])) {
            return new WP_Error('invalid_key', __('Invalid activation key.', 'buddypress'));
        }
        $signup = $signups['signups'][0];
        if ($signup->active) {
            if (empty($signup->domain)) {
                return new WP_Error('already_active', __('The user is already active.', 'buddypress'), $signup);
            } else {
                return new WP_Error('already_active', __('The site is already active.', 'buddypress'), $signup);
            }
        }
        // Password is hashed again in wp_insert_user.
        $password = wp_generate_password(12, false);
        $user_id = username_exists($signup->user_login);
        // Create the user. This should only be necessary if BP_SIGNUPS_SKIP_USER_CREATION is true.
        if (!$user_id) {
            $user_id = wp_create_user($signup->user_login, $password, $signup->user_email);
            // Otherwise, update the existing user's status.
        } elseif ($key === bp_get_user_meta($user_id, 'activation_key', true) || $key === wp_hash($user_id)) {
            // Change the user's status so they become active.
            if (!$wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_status = 0 WHERE ID = %d", $user_id))) {
                return new WP_Error('invalid_key', __('Invalid activation key.', 'buddypress'));
            }
            bp_delete_user_meta($user_id, 'activation_key');
            $member = get_userdata($user_id);
            $member->set_role(get_option('default_role'));
            $user_already_created = true;
        } else {
            $user_already_exists = true;
        }
        if (!$user_id) {
            return new WP_Error('create_user', __('Could not create user', 'buddypress'), $signup);
        }
        // Fetch the signup so we have the data later on.
        $signups = BP_Signup::get(array('activation_key' => $key));
        $signup = isset($signups['signups']) && !empty($signups['signups'][0]) ? $signups['signups'][0] : false;
        // Activate the signup.
        BP_Signup::validate($key);
        if (isset($user_already_exists)) {
            return new WP_Error('user_already_exists', __('That username is already activated.', 'buddypress'), $signup);
        }
        // Set up data to pass to the legacy filter.
        $user = array('user_id' => $user_id, 'password' => $signup->meta['password'], 'meta' => $signup->meta);
        // Notify the site admin of a new user registration.
        wp_new_user_notification($user_id);
        if (isset($user_already_created)) {
            /**
             * Fires if the user has already been created.
             *
             * @since 1.2.2
             *
             * @param int    $user_id ID of the user being checked.
             * @param string $key     Activation key.
             * @param array  $user    Array of user data.
             */
            do_action('bp_core_activated_user', $user_id, $key, $user);
            return $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);
                }
                // Save the visibility level.
                $visibility_level = !empty($user['meta']['field_' . $field_id . '_visibility']) ? $user['meta']['field_' . $field_id . '_visibility'] : 'public';
                xprofile_set_field_visibility_level($field_id, $user_id, $visibility_level);
            }
        }
    }
    // Replace the password automatically generated by WordPress by the one the user chose.
    if (!empty($user['meta']['password'])) {
        $wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id));
        /**
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:101,代码来源:bp-members-functions.php

示例5: custom_createuser

 /**
  * Creates user without email confirmation.
  *
  * @access public
  */
 public function custom_createuser()
 {
     global $wpdb;
     check_admin_referer('create-user', '_wpnonce_create-user');
     if (!current_user_can('create_users')) {
         wp_die(__('Cheatin&#8217; uh?'));
     }
     if (!is_multisite()) {
         $user_id = edit_user();
         if (is_wp_error($user_id)) {
             $add_user_errors = $user_id;
         } else {
             if (current_user_can('list_users')) {
                 $redirect = 'users.php?update=add&id=' . $user_id;
             } else {
                 $redirect = add_query_arg('update', 'add', 'user-new.php');
             }
             wp_redirect($redirect);
             die;
         }
     } else {
         /* Check if user already exists in the network */
         $user_details = get_user_by('login', $_REQUEST['user_login']);
         if (!$user_details) {
             // Adding a new user to this site
             $user_details = wpmu_validate_user_signup($_REQUEST['user_login'], $_REQUEST['email']);
             if (is_wp_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(wp_unslash($_REQUEST['user_login']), true));
                 add_filter('wpmu_signup_user_notification', '__return_false');
                 // Disable confirmation email
                 wpmu_signup_user($new_user_login, $_REQUEST['email'], array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role']));
                 $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST['email']));
                 wpmu_activate_signup($key);
                 $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
                 wp_redirect($redirect);
                 die;
             }
         } else {
             //Add existing user to the blog.
             $new_user_email = $user_details->user_email;
             $redirect = 'user-new.php';
             $username = $user_details->user_login;
             $user_id = $user_details->ID;
             add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role']));
             $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
             wp_redirect($redirect);
             die;
         }
     }
 }
开发者ID:boonebgorges,项目名称:WP-Custom-New-User,代码行数:57,代码来源:custom-user-new.php

示例6: bp_core_activate_signup

function bp_core_activate_signup($key)
{
    global $bp, $wpdb;
    $user = false;
    // Multisite installs have their own activation routine
    if (is_multisite()) {
        $user = wpmu_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 = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'activation_key' AND meta_value = %s", $key));
        if (empty($user_id)) {
            return new WP_Error('invalid_key', __('Invalid activation key', 'buddypress'));
        }
        // Change the user's status so they become active
        if (!$wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_status = 0 WHERE ID = %d", $user_id))) {
            return new WP_Error('invalid_key', __('Invalid activation key', 'buddypress'));
        }
        // Notify the site admin of a new user registration
        wp_new_user_notification($user_id);
        // Remove the activation key meta
        delete_user_meta($user_id, 'activation_key');
    }
    // Update the display_name
    wp_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'])) {
        $wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id));
    }
    // Delete the total member cache
    wp_cache_delete('bp_total_member_count', 'bp');
    do_action('bp_core_activated_user', $user_id, $key, $user);
    return $user_id;
}
开发者ID:newington,项目名称:buddypress,代码行数:50,代码来源:bp-members-signup.php

示例7: activate_user

 /**
  * Activates a user
  *
  * Depending on the result, the admin will be redirected back to the main Unconfirmed panel,
  * with additional URL params that explain success/failure.
  *
  * @package Unconfirmed
  * @since 1.0
  *
  * @uses wpmu_activate_signup() WP's core function for user activation on Multisite
  */
 function activate_user()
 {
     global $wpdb;
     // Did you mean to do this? HMMM???
     if (isset($_REQUEST['unconfirmed_bulk'])) {
         check_admin_referer('unconfirmed_bulk_action');
     } else {
         check_admin_referer('unconfirmed_activate_user');
     }
     // Get the activation key(s) out of the URL params
     if (!isset($_REQUEST['unconfirmed_key'])) {
         $this->record_status('error_nokey');
         return;
     }
     $keys = $_REQUEST['unconfirmed_key'];
     foreach ((array) $keys as $key) {
         if ($this->is_multisite) {
             $result = wpmu_activate_signup($key);
             $user_id = !is_wp_error($result) && isset($result['user_id']) ? $result['user_id'] : 0;
         } else {
             $user = $this->get_userdata_from_key($key);
             if (empty($user->ID)) {
                 $this->record_status('error_nouser');
                 return;
             } else {
                 $user_id = $user->ID;
             }
             if (empty($user_id)) {
                 return new WP_Error('invalid_key', __('Invalid activation key', 'unconfirmed'));
             }
             // Change the user's status so they become active
             if (!($result = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_status = 0 WHERE ID = %d", $user_id)))) {
                 return new WP_Error('invalid_key', __('Invalid activation key', 'unconfirmed'));
             }
         }
         if (is_wp_error($result)) {
             $this->record_status('error_couldntactivate', $key);
         } else {
             do_action('unconfirmed_user_activated', $user_id, $key);
             $this->record_status('updated_activated', $key);
         }
     }
 }
开发者ID:adenilsonpaiva,项目名称:redelivre,代码行数:54,代码来源:unconfirmed.php

示例8: apply_filters

             *
             * @since 2.0.3
             *
             * @param string $user_login The sanitized username.
             */
            $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true));
            if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) {
                add_filter('wpmu_signup_user_notification', '__return_false');
                // Disable confirmation email
                add_filter('wpmu_welcome_user_notification', '__return_false');
                // Disable welcome email
            }
            wpmu_signup_user($new_user_login, $new_user_email, array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role']));
            if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) {
                $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email));
                $new_user = wpmu_activate_signup($key);
                if (is_wp_error($new_user)) {
                    $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
                } else {
                    $redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $new_user['user_id']), 'user-new.php');
                }
            } else {
                $redirect = add_query_arg(array('update' => 'newuserconfirmation'), 'user-new.php');
            }
            wp_redirect($redirect);
            die;
        }
    }
}
$title = __('Add New User');
$parent_file = 'users.php';
开发者ID:ryelle,项目名称:WordPress,代码行数:31,代码来源:user-new.php

示例9: signup_form_shortcode

 public function signup_form_shortcode($atts, $content = NULL, $tag = '')
 {
     global $current_site;
     if (!is_multisite()) {
         return $content;
     }
     if (is_page()) {
         $this->signup_form_page = get_page_link();
         // add_filter( 'wpmu_signup_user_notification_email', array( $this, 'wpmu_signup_user_notification_email' ), 10, 5 );
         add_filter('site_url', array($this, 'site_url'), 10, 4);
     }
     $args = shortcode_atts(array('class' => 'member-signup', 'title' => sprintf(__('Get your own %s account in seconds'), $current_site->site_name), 'title_wrap' => 'h3', 'field_wrap' => 'div', 'field_wrap_class' => 'member-signup-field', 'logged_in_redirect' => false, 'logged_in_text' => __('You are logged in already. No need to register again!'), 'disabled_redirect' => false, 'disabled_text' => __('Registration has been disabled.')), $atts, $tag);
     $labels = apply_filters('gmember_signup_form_labels', array('user_name' => __('Username:'), 'user_email' => __('Email&nbsp;Address:'), 'user_pass' => __('Password:'), 'submit' => __('Submit')), $args);
     $descriptions = apply_filters('gmember_signup_form_descriptions', array('user_name' => __('(Must be at least 4 characters, letters and numbers only.)'), 'user_email' => __('We send your registration email to this address. (Double-check your email address before continuing.)')), $args);
     if (isset($_GET['key']) || isset($_POST['key'])) {
         $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
         $current = wpmu_activate_signup($key);
         if (is_wp_error($current)) {
             if ('already_active' == $current->get_error_code() || 'blog_taken' == $current->get_error_code()) {
                 $signup = $current->get_error_data();
                 $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title'), __('Your account is now active!'));
                 $activate .= gPluginHTML::tag('p', array('class' => 'lead-in member-signup-activate-text'), '' == $signup->domain . $signup->path ? sprintf(__('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('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_lostpassword_url()) : sprintf(__('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, wp_lostpassword_url()));
                 defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true);
                 return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate'), $activate);
             } else {
                 $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title member-signup-activate-error-title'), __('An error occurred during the activation'));
                 $activate .= gPluginHTML::tag('p', array('class' => 'member-signup-activate-error-text'), $current->get_error_message());
                 defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true);
                 return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate-error'), $activate);
             }
         } else {
             $user = get_userdata((int) $current['user_id']);
             $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title'), __('Your account is now active!'));
             $welcome = '<p>' . gPluginHTML::tag('span', array('class' => 'h3'), $labels['user_name']);
             $welcome .= gPluginHTML::tag('span', array(), $user->user_login) . '</p>';
             $welcome .= '<p>' . gPluginHTML::tag('span', array('class' => 'h3'), $labels['user_pass']);
             $welcome .= gPluginHTML::tag('span', array(), $current['password']) . '</p>';
             $activate .= gPluginHTML::tag('div', array('id' => 'signup-welcome', 'class' => 'member-signup-activate-welcome'), $welcome);
             $url = get_blogaddress_by_id((int) $current['blog_id']);
             $activate .= gPluginHTML::tag('p', array('class' => 'view member-signup-activate-text'), $url != network_home_url('', 'http') ? sprintf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php') : sprintf(__('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.'), network_site_url('wp-login.php', 'login'), network_home_url()));
             defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true);
             return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate'), $activate);
         }
     }
     if (is_user_logged_in()) {
         if ($args['logged_in_redirect']) {
             wp_redirect($args['logged_in_redirect']);
             die;
         } else {
             $logged_in = gPluginHTML::tag('p', array('class' => 'member-signup-logged-in'), $args['logged_in_text']);
             return gPluginHTML::tag('div', array('class' => $args['class']), $logged_in);
         }
     }
     $active_signup = apply_filters('wpmu_active_signup', get_site_option('registration', 'all'));
     // return "all", "none", "blog" or "user"
     if ($active_signup == 'none') {
         if ($args['disabled_redirect']) {
             wp_redirect($args['disabled_redirect']);
             die;
         } else {
             $disabled = gPluginHTML::tag('p', array('class' => 'member-signup-disabled'), $args['logged_disabled']);
             return gPluginHTML::tag('div', array('class' => $args['class']), $disabled);
         }
     }
     $current = array('stage' => isset($_POST['stage']) ? $_POST['stage'] : 'default', 'user_name' => isset($_POST['user_name']) ? $_POST['user_name'] : '', 'user_email' => isset($_POST['user_email']) ? $_POST['user_email'] : '', 'errors' => new WP_Error());
     switch ($current['stage']) {
         case 'validate-user-signup':
             // removed beacause: the filter not checked wp nounce if its not on wp-signup.php and wp_die is not acceptable!
             remove_filter('wpmu_validate_user_signup', 'signup_nonce_check');
             if (wp_create_nonce('member_signup_form_' . $_POST['member_signup_form_id']) != $_POST['_member_signup_form']) {
                 $error = gPluginHTML::tag('p', array('class' => 'member-signup-error'), __('Please try again.'));
                 defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true);
                 return gPluginHTML::tag('div', array('class' => $args['class']), $error);
             }
             $current = array_merge($current, wpmu_validate_user_signup($current['user_name'], $current['user_email']));
             //$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
             if (!$current['errors']->get_error_code()) {
                 wpmu_signup_user($current['user_name'], $current['user_email'], apply_filters('add_signup_meta', array()));
                 $confirm = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-title-confirm'), sprintf(__('%s is your new username'), $current['user_name']));
                 $confirm .= gPluginHTML::tag('p', array(), __('But, before you can start using your new username, <strong>you must activate it</strong>.'));
                 $confirm .= gPluginHTML::tag('p', array(), sprintf(__('Check your inbox at <strong>%s</strong> and click the link given.'), $current['user_email']));
                 $confirm .= gPluginHTML::tag('p', array(), __('If you do not activate your username within two days, you will have to sign up again.'));
                 ob_start();
                 do_action('signup_finished');
                 $confirm .= ob_get_clean();
                 defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true);
                 return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-confirm'), $confirm);
             }
     }
     $current = apply_filters('signup_user_init', $current);
     // allow definition of default variables
     ob_start();
     do_action('preprocess_signup_form');
     $pre = ob_get_clean();
     $header = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title'), $args['title']);
     $fields_hidden = gPluginHTML::tag('input', array('type' => 'hidden', 'name' => 'stage', 'value' => 'validate-user-signup'), false);
     remove_action('signup_hidden_fields', 'signup_nonce_fields');
     $id_nonce = mt_rand();
     $fields_hidden .= gPluginHTML::tag('input', array('type' => 'hidden', 'name' => 'member_signup_form_id', 'value' => $id_nonce), false);
     $fields_hidden .= wp_nonce_field('member_signup_form_' . $id_nonce, '_member_signup_form', false, false);
//.........这里部分代码省略.........
开发者ID:geminorum,项目名称:gmember,代码行数:101,代码来源:signup.class.php

示例10: wp_loaded

 public function wp_loaded()
 {
     global $pagenow;
     if (is_admin() && !is_user_logged_in() && !defined('DOING_AJAX')) {
         wp_die(__('You must log in to access the admin area.', 'rename-wp-login'));
     }
     $request = parse_url($_SERVER['REQUEST_URI']);
     if ($pagenow === 'wp-login.php' && $request['path'] !== $this->user_trailingslashit($request['path']) && get_option('permalink_structure')) {
         wp_safe_redirect($this->user_trailingslashit($this->new_login_url()) . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
         die;
     } elseif ($this->wp_login_php) {
         if (($referer = wp_get_referer()) && strpos($referer, 'wp-activate.php') !== false && ($referer = parse_url($referer)) && !empty($referer['query'])) {
             parse_str($referer['query'], $referer);
             if (!empty($referer['key']) && ($result = wpmu_activate_signup($referer['key'])) && is_wp_error($result) && ($result->get_error_code() === 'already_active' || $result->get_error_code() === 'blog_taken')) {
                 wp_safe_redirect($this->new_login_url() . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
                 die;
             }
         }
         $this->wp_template_loader();
     } elseif ($pagenow === 'wp-login.php') {
         global $error, $interim_login, $action, $user_login;
         @(require_once ABSPATH . 'wp-login.php');
         die;
     }
 }
开发者ID:IvanRF,项目名称:rename-wp-login,代码行数:25,代码来源:rename-wp-login.php

示例11: ms_activate_account

 /**
  * Activates User account on Multisite based on the given key
  * 
  * 
  */
 public static function ms_activate_account($key)
 {
     //if doing ajax, return
     if (defined('DOING_AJAX')) {
         return false;
     }
     //mimic bp activation
     $bp = buddypress();
     $signup = apply_filters('bp_core_activate_account', wpmu_activate_signup($key));
     /* If there was errors, add a message and redirect */
     if ($signup->errors) {
         bp_core_add_message(__('There was an error activating your account, please try again.', 'buddypress'), 'error');
         bp_core_redirect($bp->root_domain . '/' . bp_get_activate_slug());
         //send the activation mail in this case
     }
     $user_id = $signup['user_id'];
     //should we pass password as a param instead of the dependency here?
     $pass = $_POST['signup_password'];
     $ud = get_userdata($user_id);
     $data = array('user_login' => $ud->user_login, 'user_email' => $ud->user_email, 'user_pass' => $pass, 'ID' => $user_id, 'display_name' => bp_core_get_user_displayname($user_id));
     //update password
     if (is_multisite()) {
         wp_update_user($data);
     }
     self::update_profile_fields($user_id, $signup);
     do_action('bp_core_activated_user', $user_id, $key, $signup);
     //let bp handle the new user registerd activity
     //do_action( 'bp_core_account_activated', &$signup, $_GET['key'] );
     bp_core_add_message(__('Your account is now active!'));
     $bp->activation_complete = true;
     self::login_redirect($ud->user_login, $pass);
 }
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:37,代码来源:bp-auto-activate-auto-login.php

示例12: rpr_preprocess_signup_form

        public function rpr_preprocess_signup_form()
        {
            global $active_signup, $stage;
            switch ($stage) {
                case 'user-signup':
                    if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') {
                        /* begin validate_user_signup stage */
                        // validate signup form, do wpmu_validate_user_signup action
                        $result = wpmu_validate_user_signup(isset($_POST['user_name']) ? (string) $_POST['user_name'] : "", isset($_POST['user_email']) ? (string) $_POST['user_email'] : "");
                        extract($result);
                        if ($errors->get_error_code()) {
                            echo "signup_user";
                            signup_user($user_name, $user_email, $errors);
                            do_action('after_signup_form');
                            get_footer();
                            exit;
                        }
                        if ('blog' === $_POST['signup_for']) {
                            echo "signup_blog";
                            signup_blog($user_name, $user_email);
                            do_action('after_signup_form');
                            get_footer();
                            exit;
                        }
                        // collect meta, commit user to database, send email
                        wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array()));
                        // previously, displayed confirm_user_signup message before signup_finished action
                        do_action('signup_finished');
                        /* end validate_user_signup stage */
                    } else {
                        _e('User registration has been disabled.');
                        ?>
						</div>
						</div>
						<?php 
                        do_action('after_signup_form');
                        get_footer();
                        exit;
                    }
                    break;
                case 'blog-signup':
                    if ($active_signup == 'all' || $active_signup == 'blog') {
                        /* begin validate_blog_signup stage */
                        $result = wpmu_validate_user_signup(isset($_POST['user_name']) ? (string) $_POST['user_name'] : "", isset($_POST['user_email']) ? (string) $_POST['user_email'] : "");
                        extract($result);
                        if ($errors->get_error_code()) {
                            echo "signup_user";
                            signup_user($user_name, $user_email, $errors);
                            do_action('after_signup_form');
                            get_footer();
                            exit;
                        }
                        $result = wpmu_validate_blog_signup(isset($_POST['blogname']) ? (string) $_POST['blogname'] : "", isset($_POST['blog_title']) ? (string) $_POST['blog_title'] : "");
                        extract($result);
                        if ($errors->get_error_code()) {
                            signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
                            do_action('after_signup_form');
                            get_footer();
                            exit;
                        }
                        // collect meta, commit user to database, send email
                        $meta = array('lang_id' => 1, 'public' => (int) $_POST['blog_public']);
                        wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, apply_filters('add_signup_meta', $meta));
                        // previously, displayed confirm_blog_signup message before signup_finished action
                        do_action('signup_finished');
                        /* end validate_blog_signup stage */
                    } else {
                        _e('Site registration has been disabled.');
                        ?>
						</div>
						</div>
						<?php 
                        do_action('after_signup_form');
                        get_footer();
                        exit;
                    }
                    break;
                default:
                    return;
            }
            /* begin wp-activate page */
            $key = (string) $_REQUEST['key'];
            // wpmu_create_user, wpmu_welcome_user_notification, add_new_user_to_blog, do wpmu_activate_user action
            $result = wpmu_activate_signup($key);
            if (is_wp_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('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_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, wp_lostpassword_url());
                    }
                    echo '</p>';
//.........这里部分代码省略.........
开发者ID:bvassmer,项目名称:Register-Plus-Redux,代码行数:101,代码来源:rpr-signup.php

示例13: bp_core_activation_do_activation

function bp_core_activation_do_activation()
{
    global $current_site, $blog_id, $user_id;
    ?>
	
	<?php 
    if (empty($_GET['key']) && empty($_POST['key'])) {
        ?>

		<h3><?php 
        _e('Activation Key Required', 'buddypress');
        ?>
</h3>
		
		<p id="intro-text"><?php 
        _e('This is the key contained in the email you were sent after registering for this site.', 'buddypress');
        ?>
</p>
			
		<div class="field-box">
			<form name="activateform" id="activateform" method="post" action="<?php 
        echo 'http://' . $current_site->domain . $current_site->path;
        ?>
wp-activate.php">
				<p>
				    <label for="key"><?php 
        _e('Activation Key:', 'buddypress');
        ?>
</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 
        _e('Activate &raquo;', 'buddypress');
        ?>
"/>
				</p>
			</form>
		</div>
		
	<?php 
    } else {
        $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
        $result = wpmu_activate_signup($key);
        if (is_wp_error($result)) {
            if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) {
                $signup = $result->get_error_data();
                ?>
				
				<h3><?php 
                _e('Your account is now active!', 'buddypress');
                ?>
</h3>
				
				<?php 
                _e('Your account has already been activated. You can now log in with the account details that were emailed to you.');
            } else {
                ?>
				<h2><?php 
                _e('An error occurred during the activation', 'buddypress');
                ?>
</h2>
				<?php 
                echo '<p>' . $result->get_error_message() . '</p>';
            }
        } else {
            extract($result);
            $user = new WP_User((int) $user_id);
            ?>
			
			<h3><?php 
            _e('Your account is now active!', 'buddypress');
            ?>
</h3>
			
			<p class="view"><?php 
            printf(__('Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.', 'buddypress'), site_url('wp-login.php?redirect_to=' . site_url()), site_url());
            ?>
</p>
			
			<div class="field-box" id="signup-welcome">
				<p><span class="label"><?php 
            _e('Username:', 'buddypress');
            ?>
</span> <?php 
            echo $user->user_login;
            ?>
</p>
				<p><span class="label"><?php 
            _e('Password:', 'buddypress');
            ?>
</span> <?php 
            echo $password;
            ?>
</p>
			</div>
			
			<?php 
            do_action('bp_activation_extras', $user_id, $meta);
        }
//.........这里部分代码省略.........
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:101,代码来源:bp-core-activation.php

示例14: bp_core_activate_signup

function bp_core_activate_signup( $key ) {
	global $bp, $wpdb;

	$user = false;

	/* Multisite installs have their own activation routine */
	if ( bp_core_is_multisite() ) {
		$user = wpmu_activate_signup( $key );

		/* If there was errors, add a message and redirect */
		if ( $user->errors ) {
			bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' );
			bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG );
		}

		$user_id = $user['user_id'];

		/* Set any profile data */
		if ( function_exists( 'xprofile_set_field_data' ) ) {
			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 = $user['meta']["field_{$field_id}"];

					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 = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'activation_key' AND meta_value = %s", $key ) );

		if ( empty( $user_id ) )
			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );

		/* Change the user's status so they become active */
		if ( !$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) ) )
			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );

		/* Notify the site admin of a new user registration */
		wp_new_user_notification( $user_id );

		/* Remove the activation key meta */
		delete_user_meta( $user_id, 'activation_key' );
	}

	/* Update the user_url and display_name */
	wp_update_user( array( 'ID' => $user_id, 'user_url' => bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), 'display_name' => bp_core_get_user_displayname( $user_id ) ) );

	/* Add a last active entry */
	update_user_meta( $user_id, 'last_activity', bp_core_current_time() );

	/* Set the password on multisite installs */
	if ( bp_core_is_multisite() && !empty( $user['meta']['password'] ) )
		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id ) );

	/* Delete the total member cache */
	wp_cache_delete( 'bp_total_member_count', 'bp' );

	do_action( 'bp_core_activated_user', $user_id, $key, $user );

	return $user_id;
}
开发者ID:n-sane,项目名称:zaroka,代码行数:66,代码来源:bp-core-signup.php

示例15: activate_blog

 public static function activate_blog($data, $trial = false, $period = 1, $level = 1, $expire = false)
 {
     global $psts, $wpdb;
     $user_pass = false;
     if (!is_array($data)) {
         $key = $data;
     } else {
         $key = isset($data['activation_key']) ? $data['activation_key'] : false;
         $user_pass = isset($data['new_blog_details']['user_pass']) ? $data['new_blog_details']['user_pass'] : false;
     }
     if (empty($key)) {
         return false;
     }
     // In case we're in session
     $session_data['new_blog_details'] = ProSites_Helper_Session::session('new_blog_details');
     $user_pass = empty($user_pass) && isset($session_data['new_blog_details']['user_pass']) ? $session_data['new_blog_details']['user_pass'] : $user_pass;
     if (!empty($user_pass)) {
         self::$temp_pass = $user_pass;
         add_filter('update_welcome_email', array('ProSites_Helper_Registration', 'update_welcome_email'), 10, 6);
     }
     // Activate the user signup
     $result = wpmu_activate_signup($key);
     $signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->signups} WHERE activation_key = %s", $key));
     // If the blog has already been activated, we still need some information from the signup table
     if (is_wp_error($result)) {
         $result = array();
         if (empty($signup)) {
             return 0;
         }
         $user_id = username_exists($signup->user_login);
         $blog_id = domain_exists($signup->domain, $signup->path, $wpdb->siteid);
         // As a fallback, try the site domain
         if (empty($blog_id)) {
             $domain = $wpdb->get_var($wpdb->prepare("SELECT domain FROM {$wpdb->site} WHERE id = %d", $wpdb->siteid));
             $blog_id = domain_exists($domain, $signup->path, $wpdb->siteid);
         }
         $result['user_id'] = $user_id;
         $result['blog_id'] = (int) $blog_id;
     }
     /**
      * Update coupon information
      */
     if (!empty($signup)) {
         //				$blog_id = $result['blog_id'];
         //				$signup_meta = maybe_unserialize( $signup->meta );
         //
         //				// Unlikely that this will have a coupon, but make sure
         //				$used = (array) get_blog_option( $blog_id, 'psts_used_coupons' );
         //
         //				// Is there a coupon stored in the signup_meta?
         //				if( isset( $signup_meta['psts_used_coupons'] ) && ! empty( $signup_meta['psts_used_coupons'] ) && is_array( $signup_meta['psts_used_coupons'] ) ) {
         //					// Merge and make sure we don't record the same coupon twice
         //					$used = array_merge( $used, $signup_meta['psts_used_coupons'] );
         //					$used = array_unique( $used );
         //					// Remove from signup meta
         //					unset( $signup_meta['psts_used_coupons'] );
         //					$psts->update_signup_meta( $signup_meta, $key );
         //				}
         //				if( ! empty( $used ) ) {
         //					// Add to blog options
         //					update_blog_option( $blog_id, 'psts_used_coupons', $used );
         //				}
     }
     /**
      * @todo: Make sure we dont over extend
      */
     //Set Trial
     if ($trial) {
         $trial_days = $psts->get_setting('trial_days', 0);
         // Set to first level for $trial_days
         $psts->extend($result['blog_id'], $period, 'Trial', $level, '', strtotime('+ ' . $trial_days . ' days'));
         //Redirect to checkout on next signup
         /**
          * @todo May not be needed here anymore
          */
         //update_blog_option( $result['blog_id'], 'psts_signed_up', 1 );
     }
     if (!empty($user_pass)) {
         $result['password'] = $user_pass;
     }
     // Contains $result['password'] for new users
     return $result;
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:83,代码来源:Registration.php


注:本文中的wpmu_activate_signup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。