• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpmu_validate_blog_signup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: validate

 function validate($errors)
 {
     $user = apply_filters('ns_wp_create_site_admin', wp_get_current_user());
     $site_meta = apply_filters('ns_wp_create_site_meta', array("public" => 1));
     // use wp's built in wpmu_validate_blog_signup validation for all new site vars
     // also, use a test on  a known valid name/title to filter out any validation errors added by other plugins via the wpmu_validate_blog_signup filter
     $baseline_validation = wpmu_validate_blog_signup('1000000', 'NS Cloner Test');
     $current_site_validation = wpmu_validate_blog_signup($this->cloner->request["target_name"], $this->cloner->request["target_title"], $user);
     $site_errors = array_diff($current_site_validation['errors']->get_error_messages(), $baseline_validation['errors']->get_error_messages());
     foreach ($site_errors as $error) {
         // if the error is only because there are dashes in the site name, ignore the error since that's fine/allowable
         if ($error == 'Only lowercase letters (a-z) and numbers are allowed.' && preg_match('/^[a-z0-9-]+$/', $this->cloner->request["target_name"])) {
             continue;
         }
         // otherwise add the error to the list so it can get sent back
         $errors[] = array('message' => $error, 'section' => $this->id);
     }
     return $errors;
 }
开发者ID:alpual,项目名称:Caitlin-Sabo,代码行数:19,代码来源:ns-cloner-section-create-target.php


示例2: ns_wp_create_site

/**
 * Create site
 */
function ns_wp_create_site($site_name, $site_title, $logfile)
{
    $user = apply_filters('ns_wp_create_site_admin', wp_get_current_user());
    $site_meta = apply_filters('ns_wp_create_site_meta', array("public" => 1));
    // use wp's built in wpmu_validate_blog_signup validation for all new site vars
    // also, use a test on  a known valid name/title to filter out any validation errors added by other plugins via the wpmu_validate_blog_signup filter
    $baseline_validation = wpmu_validate_blog_signup('1000000', 'NS Cloner Test');
    $site_data = wpmu_validate_blog_signup($site_name, $site_title, $user);
    $site_errors = array_diff($baseline_validation['errors']->get_error_messages(), $site_data['errors']->get_error_messages());
    if (!empty($site_errors) && false) {
        ns_log_write(array("Error creating site with name '{$site_name}' and title '{$site_title}'. One or more problems errors detected by WP:", $site_errors), $logfile);
        return false;
    }
    $site_id = wpmu_create_blog($site_data["domain"], $site_data["path"], $site_title, $site_data["user"]->ID, $site_meta, get_current_site()->id);
    if (!is_wp_error($site_id)) {
        ns_log_write("New site with name '{$site_name}' and title '{$site_title}' (" . get_site_url($site_id) . ") successfully created!", $logfile);
        return $site_id;
    } else {
        ns_log_write("Error creating site with domain '{$site_name}' and path '{$site_title}' - " . $site_id->get_error_message(), $logfile);
        return false;
    }
}
开发者ID:AlexanderDolgan,项目名称:ojahuri,代码行数:25,代码来源:ns-wp-utils.php


示例3: bp_groupblog_validate_blog_form

/**
 * bp_groupblog_validate_blog_form()
 *
 * This function validates that the blog does not exist already, illegal names, etc...
 */
function bp_groupblog_validate_blog_form()
{
    $user = '';
    if (is_user_logged_in()) {
        $user = wp_get_current_user();
    }
    $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
    $errors = $result['errors'];
    // we only want to filter if there is an error
    if (!is_object($errors)) {
        return $result;
    }
    $checks = get_site_option('bp_groupblog_blog_defaults_options');
    // create a new var to hold errors
    $newerrors = new WP_Error();
    // loop through the errors and look for the one we are concerned with
    foreach ($errors->errors as $key => $value) {
        // if the error is with the blog name, check to see which one
        if ($key == 'blogname') {
            foreach ($value as $subkey => $subvalue) {
                switch ($subvalue) {
                    case 'Only lowercase letters and numbers allowed':
                        $allowedchars = '';
                        if ($checks['allowdashes'] == 1) {
                            $allowedchars .= '-';
                        }
                        if ($checks['allowunderscores'] == 1) {
                            $allowedchars .= '_';
                        }
                        $allowed = '/[a-z0-9' . $allowedchars . ']+/';
                        preg_match($allowed, $result['blogname'], $maybe);
                        if ($result['blogname'] != $maybe[0]) {
                            //still fails, so add an error to the object
                            $newerrors->add('blogname', __("Only lowercase letters and numbers allowed", 'groupblog'));
                        }
                        continue;
                    case 'Blog name must be at least 4 characters':
                        if (strlen($result['blogname']) < $checks[minlength] && !is_super_admin()) {
                            $newerrors->add('blogname', __("Blog name must be at least " . $checks[minlength] . " characters", 'groupblog'));
                        }
                        continue;
                    case "Sorry, blog names may not contain the character '_'!":
                        if ($checks['allowunderscores'] != 1) {
                            $newerrors->add('blogname', __("Sorry, blog names may not contain the character '_'!", 'groupblog'));
                        }
                        continue;
                    case 'Sorry, blog names must have letters too!':
                        if ($checks['allownumeric'] != 1) {
                            $newerrors->add('blogname', __("Sorry, blog names must have letters too!", 'groupblog'));
                        }
                        continue;
                    default:
                        $newerrors->add('blogname', $subvalue);
                }
                // end switch
            }
        } else {
            //Add all other errors into the error object, but they're in sub-arrays, so loop through to get the right stuff.
            foreach ($value as $subkey => $subvalue) {
                $newerrors->add($key, $subvalue);
            }
        }
    }
    //unset the error object from the results & rest it with our new errors
    unset($result['errors']);
    $result['errors'] = $newerrors;
    return $result;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:73,代码来源:bp-groupblog.php


示例4: tml_display_register

        /**
         * Displays the registration page
         *
         * @since 6.1
         * @access public
         *
         * @param object $template Theme_My_Login_Template object
         */
        public function tml_display_register(&$template)
        {
            global $wpdb, $blogname, $blog_title, $domain, $path, $active_signup;
            $theme_my_login = Theme_My_Login::get_object();
            do_action('before_signup_form');
            echo '<div class="login mu_register" id="theme-my-login' . esc_attr($template->get_option('instance')) . '">';
            $active_signup = get_site_option('registration');
            if (!$active_signup) {
                $active_signup = 'all';
            }
            $active_signup = apply_filters('wpmu_active_signup', $active_signup);
            // return "all", "none", "blog" or "user"
            // Make the signup type translatable.
            $i18n_signup['all'] = _x('all', 'Multisite active signup type');
            $i18n_signup['none'] = _x('none', 'Multisite active signup type');
            $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
            $i18n_signup['user'] = _x('user', 'Multisite active signup type');
            if (is_super_admin()) {
                echo '<p class="message">' . sprintf(__('Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.', 'theme-my-login'), $i18n_signup[$active_signup], esc_url(network_admin_url('ms-options.php'))) . '</p>';
            }
            $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
            $current_user = wp_get_current_user();
            if ($active_signup == "none") {
                _e('Registration has been disabled.', 'theme-my-login');
            } elseif ($active_signup == 'blog' && !is_user_logged_in()) {
                printf(__('You must first <a href="%s">log in</a>, and then you can create a new site.', 'theme-my-login'), wp_login_url(Theme_My_Login_Common::get_current_url()));
            } else {
                $stage = isset($_POST['stage']) ? $_POST['stage'] : 'default';
                switch ($stage) {
                    case 'validate-user-signup':
                        if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') {
                            $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_user($user_name, $user_email);
                                break;
                            }
                            if ('blog' == $_POST['signup_for']) {
                                $this->signup_blog($user_name, $user_email);
                                break;
                            }
                            wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array()));
                            ?>
						<h2><?php 
                            printf(__('%s is your new username', 'theme-my-login'), $user_name);
                            ?>
</h2>
						<p><?php 
                            _e('But, before you can start using your new username, <strong>you must activate it</strong>.', 'theme-my-login');
                            ?>
</p>
						<p><?php 
                            printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.', 'theme-my-login'), $user_email);
                            ?>
</p>
						<p><?php 
                            _e('If you do not activate your username within two days, you will have to sign up again.', 'theme-my-login');
                            ?>
</p>
						<?php 
                            do_action('signup_finished');
                        } else {
                            _e('User registration has been disabled.', 'theme-my-login');
                        }
                        break;
                    case 'validate-blog-signup':
                        if ($active_signup == 'all' || $active_signup == 'blog') {
                            // Re-validate user info.
                            $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_user($user_name, $user_email);
                                break;
                            }
                            $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
                            extract($result);
                            $theme_my_login->errors = $errors;
                            if ($errors->get_error_code()) {
                                $this->signup_blog($user_name, $user_email, $blogname, $blog_title);
                                break;
                            }
                            $public = (int) $_POST['blog_public'];
                            $meta = array('lang_id' => 1, 'public' => $public);
                            $meta = apply_filters('add_signup_meta', $meta);
                            wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
                            ?>
						<h2><?php 
                            printf(__('Congratulations! Your new site, %s, is almost ready.', 'theme-my-login'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>");
                            ?>
</h2>
//.........这里部分代码省略.........
开发者ID:tkxhoa,项目名称:movie,代码行数:101,代码来源:class-theme-my-login-ms-signup.php


示例5: registerUser

 private function registerUser()
 {
     global $userMeta;
     /// $userData: array.
     $userData = apply_filters('user_meta_pre_user_register', $this->userData);
     if (is_wp_error($userData)) {
         return $userMeta->showError($userData);
     }
     if (is_multisite() && wp_verify_nonce(@$_POST['um_newblog'], 'blogname') && !empty($_POST['blogname'])) {
         $blogData = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
         if ($blogData['errors']->get_error_code()) {
             return $userMeta->showError($blogData['errors']);
         }
     }
     // If add_user_to_blog set true in UserMeta settings panel
     $userID = null;
     if (is_multisite()) {
         $registrationSettings = $userMeta->getSettings('registration');
         if (!empty($registrationSettings['add_user_to_blog'])) {
             $user_login = sanitize_user($userData['user_login'], true);
             $userID = username_exists($user_login);
             if ($userID) {
                 $blog_id = get_current_blog_id();
                 if (!is_user_member_of_blog($userID, $blog_id)) {
                     add_user_to_blog($blog_id, $userID, get_option('default_role'));
                 } else {
                     $userID = null;
                 }
             }
         }
     }
     $response = $userMeta->insertUser($userData, $userID);
     if (is_wp_error($response)) {
         return $userMeta->showError($response);
     }
     if (isset($blogData)) {
         $responseBlog = $userMeta->registerBlog($blogData, $userData);
         if (is_wp_error($responseBlog)) {
             return $userMeta->showError($responseBlog);
         }
     }
     /// Allow to populate form data based on DB instead of $_REQUEST
     $userMeta->showDataFromDB = true;
     $registrationSettings = $userMeta->getSettings('registration');
     $activation = $registrationSettings['user_activation'];
     if ($activation == 'auto_active') {
         $msg = $userMeta->getMsg('registration_completed');
     } elseif ($activation == 'email_verification') {
         $msg = $userMeta->getMsg('sent_verification_link');
     } elseif ($activation == 'admin_approval') {
         $msg = $userMeta->getMsg('wait_for_admin_approval');
     } elseif ($activation == 'both_email_admin') {
         $msg = $userMeta->getMsg('sent_link_wait_for_admin');
     }
     if (!$userMeta->isPro()) {
         wp_new_user_notification($response['ID'], $response['user_pass']);
     }
     if ($activation == 'auto_active') {
         if (!empty($registrationSettings['auto_login'])) {
             $userMeta->doLogin($response);
         }
     }
     do_action('user_meta_after_user_register', (object) $response);
     $html = $userMeta->showMessage($msg);
     if (isset($responseBlog)) {
         $html .= $userMeta->showMessage($responseBlog);
     }
     $role = $userMeta->getUserRole($response['ID']);
     $redirect_to = $userMeta->getRedirectionUrl(null, 'registration', $role);
     if ($userMeta->isHookEnable('registration_redirect')) {
         $redirect_to = apply_filters('registration_redirect', $redirect_to, $response['ID']);
     }
     if ($redirect_to) {
         if (empty($_REQUEST['is_ajax'])) {
             wp_redirect($redirect_to);
             exit;
         }
         $timeout = $activation == 'auto_active' ? 3 : 5;
         $html .= $userMeta->jsRedirect($redirect_to, $timeout);
     }
     $html = "<div action_type=\"registration\">" . $html . "</div>";
     return $userMeta->printAjaxOutput($html);
 }
开发者ID:robbenz,项目名称:plugs,代码行数:83,代码来源:umUserInsertClass.php


示例6: validate_multisite_submission

 public static function validate_multisite_submission($form, $config, $pagenum)
 {
     global $path;
     $multisite_options = $config['meta']['multisite_options'];
     // make sure multisite create site option is set
     if (empty($multisite_options['create_site'])) {
         return $form;
     }
     // $_POST to Entry
     $entry = self::convert_post_to_entry();
     $domain = '';
     $site_address_field = RGFormsModel::get_field($form, $multisite_options['site_address']);
     $site_address = self::get_prepared_value($site_address_field, $multisite_options['site_address'], $entry);
     $site_title_field = RGFormsModel::get_field($form, $multisite_options['site_title']);
     $site_title = self::get_prepared_value($site_title_field, $multisite_options['site_title'], $entry);
     // get validation result for multi-site fields
     $validation_result = wpmu_validate_blog_signup($site_address, $site_title, wp_get_current_user());
     $error_msg = false;
     // site address validation, only if on correct page
     if ($site_address_field['pageNumber'] == $pagenum) {
         $error_msg = isset($validation_result['errors']->errors['blogname'][0]) ? $validation_result['errors']->errors['blogname'][0] : false;
         if ($error_msg != false) {
             $form = self::add_validation_failure($multisite_options['site_address'], $form, $error_msg);
         }
     }
     // site title validation, only if on correct page
     if ($site_title_field['pageNumber'] == $pagenum) {
         $error_msg = isset($validation_result['errors']->errors['blog_title'][0]) ? $validation_result['errors']->errors['blog_title'][0] : false;
         if ($error_msg != false) {
             $form = self::add_validation_failure($multisite_options['site_title'], $form, $error_msg);
         }
     }
     return $form;
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:34,代码来源:userregistration.php


示例7: bp_core_validate_blog_signup

/**
 * Validate blog URL and title provided at signup.
 *
 * @since 1.2.2
 *
 * @todo Why do we have this wrapper?
 *
 * @param string $blog_url   Blog URL requested during registration.
 * @param string $blog_title Blog title requested during registration.
 * @return array
 */
function bp_core_validate_blog_signup($blog_url, $blog_title)
{
    if (!is_multisite() || !function_exists('wpmu_validate_blog_signup')) {
        return false;
    }
    /**
     * Filters the validated blog url and title provided at signup.
     *
     * @since 1.2.2
     *
     * @param array $value Array with the new site data and error messages.
     */
    return apply_filters('bp_core_validate_blog_signup', wpmu_validate_blog_signup($blog_url, $blog_title));
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:25,代码来源:bp-members-functions.php


示例8: bp_core_validate_blog_signup

function bp_core_validate_blog_signup($blog_url, $blog_title)
{
    if (!is_multisite() || !function_exists('wpmu_validate_blog_signup')) {
        return false;
    }
    return apply_filters('bp_core_validate_blog_signup', wpmu_validate_blog_signup($blog_url, $blog_title));
}
开发者ID:newington,项目名称:buddypress,代码行数:7,代码来源:bp-members-signup.php


示例9: validate_blog_signup

/**
 * Validate new site signup
 *
 * @since MU
 *
 * @return bool True if the site signup was validated, false if error
 */
function validate_blog_signup()
{
    // Re-validate user info.
    $user_result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
    $user_name = $user_result['user_name'];
    $user_email = $user_result['user_email'];
    $user_errors = $user_result['errors'];
    if ($user_errors->get_error_code()) {
        signup_user($user_name, $user_email, $user_errors);
        return false;
    }
    $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
    $domain = $result['domain'];
    $path = $result['path'];
    $blogname = $result['blogname'];
    $blog_title = $result['blog_title'];
    $errors = $result['errors'];
    if ($errors->get_error_code()) {
        signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
        return false;
    }
    $public = (int) $_POST['blog_public'];
    $signup_meta = array('lang_id' => 1, 'public' => $public);
    // Handle the language setting for the new site.
    if (!empty($_POST['WPLANG'])) {
        $languages = signup_get_available_languages();
        if (in_array($_POST['WPLANG'], $languages)) {
            $language = wp_unslash(sanitize_text_field($_POST['WPLANG']));
            if ($language) {
                $signup_meta['WPLANG'] = $language;
            }
        }
    }
    /** This filter is documented in wp-signup.php */
    $meta = apply_filters('add_signup_meta', $signup_meta);
    wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
    confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
    return true;
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:46,代码来源:wp-signup.php


示例10: add_filter

    return FALSE;
}
add_filter('wpmu_signup_blog_notification', 'psu_signup_blog_notification', 11, 7);
// we don't want crawlers to index this page, if they ever get here.
function signuppageheaders()
{
    echo "<meta name='robots' content='noindex,nofollow' />\n";
}
add_action('wp_head', 'signuppageheaders');
// put a header on the page
get_header();
/*
	Set the information about the user and his/her new blog.
	Make changes here as appropriate for your site.
*/
$user_email = $username . '@site.org';
/*
	Set the url for the new blog based on the username returned from CAS.
	Underscores aren't allowed in MU blog addresses; 
	You may have to clean your usernames in other ways as well.
*/
$sitename = str_replace('_', '-', $username);
/*
	We can't use the global $domain, it turns out, because it isn't set to the 
	base domain, but to the subdomain of whatever blog the user is currently visiting.
*/
$domain = $sitename . '.blogs.site.org';
// provision it
wpmu_signup_blog($domain, $base, $sitename, $username, $user_email);
wpmu_validate_blog_signup();
开发者ID:syntagma,项目名称:wpcas,代码行数:30,代码来源:provisioning_example.php


示例11: register_site

 /**
  * Registers a new blog signup
  *
  * @since MU
  *
  * @uses wp_get_current_user() to retrieve the current user
  * @uses wpmu_validate_blog_signup() to validate site availability
  * @uses wpmu_create_blog() to add a new site
  * @return bool Object containing site information or errors object if error
  */
 function register_site()
 {
     global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
     if (!is_user_logged_in()) {
         $error = new WP_Error();
         $error->add('user', __('You must be logged in to create a site.'));
         return $error;
     }
     if (is_array(get_site_option('illegal_names')) && isset($_POST['blogname']) && in_array($_POST['blogname'], get_site_option('illegal_names')) == true) {
         $error = new WP_Error();
         $error->add('illegal_name', __('This site name is not allowed.'));
         return $error;
     }
     $newblogname = isset($_POST['blogname']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_POST['blogname'])) : null;
     $user = '';
     if (is_user_logged_in()) {
         $user = wp_get_current_user();
     }
     $result = wpmu_validate_blog_signup($newblogname, $_POST['blog_title'], $user);
     extract($result);
     if ($errors->get_error_code()) {
         return $errors;
     }
     $public = (int) $_POST['blog_public'];
     $blog_meta_defaults = array('lang_id' => 1, 'public' => $public);
     /**
      * Filter the new site meta variables.
      *
      * @since MU
      * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead.
      *
      * @param array $blog_meta_defaults An array of default blog meta variables.
      */
     $meta = apply_filters('signup_create_blog_meta', $blog_meta_defaults);
     /**
      * Filter the new default site meta variables.
      *
      * @since 3.0.0
      *
      * @param array $meta {
      *     An array of default site meta variables.
      *
      *     @type int $lang_id     The language ID.
      *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
      * }
      */
     $meta = apply_filters('add_signup_meta', $meta);
     $result = wpmu_create_blog($domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid);
     if ($errors->get_error_code()) {
         return $errors;
     }
     $result = array('blogname' => $newblogname, 'blog_title' => $blog_title);
     $result = array('status' => 'ok', 'created' => true, 'site' => $result);
     return $result;
 }
开发者ID:andreiRS,项目名称:Radii8,代码行数:65,代码来源:user.php


示例12: signup_redirect_checkout

	/**
	 * Redirect user to checkout page after signup
	 *
	 * @param type $blog_id
	 * @param type $user_id
	 * @param type $domain
	 * @param type $path
	 * @param type $site_id
	 * @param type $meta
	 */
	function signup_redirect_checkout() {
		global $wpdb;

		//If pay before blog is disabled, allow blog activation through email
		$show_signup = $this->get_setting( 'show_signup' );

		if ( 1 != $show_signup ) {
			return;
		}

		if ( ( empty( $_POST['signup_blog_url'] ) && empty( $_POST['blogname'] ) ) ||
		     ! isset( $_POST['psts_signed_up'] ) || $_POST['psts_signed_up'] != 'yes'
		) {
			//No post details to check
			return;
		}

		/* Remove confirmation text between filter and action, this could be removed if confirm_blog_signup gets a filter */
		ob_get_clean();

		$blogname  = ! empty( $_POST['blogname'] ) ? $_POST['blogname'] : ( ! empty( $_POST['signup_blog_url'] ) ? $_POST['signup_blog_url'] : '' );
		$blogtitle = ! empty( $_POST['blog_title'] ) ? $_POST['blog_title'] : ( ! empty( $_POST['signup_blog_title'] ) ? $_POST['signup_blog_title'] : '' );

		$blog_details = wpmu_validate_blog_signup( $blogname, $blogtitle );

		if ( empty( $blog_details ['domain'] ) ) {
			return;
		}
		$domain = $blog_details['domain'];
		//Check if blog is in trial or inactive, set session values and redirect to checkout page
		$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s", $domain ) );
		if ( ! $signup->active ) {
			ProSites_Helper_Session::session( 'domain', $domain );
			ProSites_Helper_Session::session( 'meta', $signup->meta );
			?>
			<!--redirect to checkout url-->
			<script type="text/javascript">
				window.location = '<?php echo $this->checkout_url(); ?>';
			</script><?php
		}

		return;

	}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:54,代码来源:pro-sites.php


示例13: ajax_check_prosite_blog

 public static function ajax_check_prosite_blog()
 {
     global $psts, $current_site;
     $blog_data = array();
     // Add ajax session var
     ProSites_Helper_Session::session('psts_ajax_session_activated', true);
     // Introduce a fake error because we don't want to actually create the blog yet.
     add_filter('registration_errors', array('ProSites_Model_Registration', 'prosite_blog_check_only'), 10, 3);
     // replace $_POST with array data
     $params = array();
     parse_str($_POST['data'], $params);
     $period = (int) $_POST['period'];
     $level = 'free' == $_POST['level'] ? $_POST['level'] : (int) $_POST['level'];
     $_POST = $params;
     $doing_ajax = defined('DOING_AJAX') && DOING_AJAX ? true : false;
     $ajax_response = array();
     if ($doing_ajax) {
         $user_name = sanitize_text_field($_POST['user_name']);
         $user_email = sanitize_email($_POST['user_email']);
         $blogname = sanitize_text_field($_POST['blogname']);
         $blog_title = sanitize_text_field(urldecode($_POST['blog_title']));
         // Process some cleaning up if needed
         do_action('prosite_register_blog_pre_validation', $user_name, $user_email, $blogname);
         $blog_validation = wpmu_validate_blog_signup($blogname, $blog_title);
         // Attempt to create a new user (knowing that it will fail, but it should only have our error)
         if (!isset($_POST['new_blog'])) {
             $validation = wpmu_validate_user_signup($user_name, $user_email);
             // nicer errors, but doesn't deal with custom fields
             $user_check = register_new_user($user_name, $user_email);
             // checks custom fields, but ugly errors
             $user_check->errors = array_merge($user_check->errors, $validation['errors']->errors);
             $user_check->errors = array_merge($user_check->errors, $blog_validation['errors']->errors);
         } else {
             $user_check = new WP_Error();
             $user_check->errors = array_merge($user_check->errors, $blog_validation['errors']->errors);
         }
         // Replaced session vars to make it semi-stateless, will pick these up in a session later
         $blog_data['new_blog_details'] = array();
         $blog_data['new_blog_details']['username'] = $user_name;
         $blog_data['new_blog_details']['email'] = $user_email;
         $blog_data['new_blog_details']['blogname'] = $blogname;
         $blog_data['new_blog_details']['title'] = $blog_title;
         $blog_data['new_blog_details']['level'] = $level;
         $blog_data['new_blog_details']['period'] = $period;
         $username_available = true;
         $email_available = true;
         $blogname_available = true;
         $blogtitle_available = true;
         // Checking passed...
         if (!empty($user_check->errors) && 1 == count($user_check->errors) && !isset($_POST['new_blog']) || 0 == count($user_check->errors) && isset($_POST['new_blog'])) {
             $keys = array_keys($user_check->errors);
             if ($keys && !in_array('availability_check_only', $keys) && !isset($_POST['new_blog'])) {
                 // Something went wrong!
                 $ajax_response['user_available'] = false;
             } else {
                 // All good!  We're ready to create the user/site
                 /** User is validated using register_new_user so that we can use the hooks and make them available,
                  * but we still need to actually create and activate the signup to get the $user_id. */
                 $blog = $blog_validation;
                 $domain = $blog['domain'];
                 $path = $blog['path'];
                 $blogname = $blog['blogname'];
                 $blog_title = $blog['blog_title'];
                 $errors = $blog['errors'];
                 // Privacy setting
                 $public = (int) $_POST['blog_public'];
                 $signup_meta = array('lang_id' => 1, 'public' => $public);
                 // Create the signup
                 $meta = apply_filters('add_signup_meta', $signup_meta);
                 $result = ProSites_Helper_Registration::signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
                 $blog_data['activation_key'] = $result['activation_key'];
                 if (isset($result['user_pass']) && !empty($result['user_pass'])) {
                     $blog_data['new_blog_details']['user_pass'] = $result['user_pass'];
                 }
                 $trial_days = $psts->get_setting('trial_days', 0);
                 $trial_active = !empty($trial_days);
                 $site_name = '';
                 if (!is_subdomain_install()) {
                     $site_name = $current_site->domain . $current_site->path . $blogname;
                 } else {
                     $site_name = $blogname . '.' . ($site_domain = preg_replace('|^www\\.|', '', $current_site->domain));
                 }
                 if ($trial_active) {
                     $recurring = $psts->get_setting('recurring_subscriptions', 1);
                     if ($recurring) {
                         $blog_data['new_blog_details']['reserved_message'] = sprintf('<div class="reserved_msg"><h2>' . __('Activate your site', 'psts') . '</h2>' . __('<p>Your site <strong>(%s)</strong> has been reserved but is not yet activated.</p><p>Once payment information has been verified your trial period will begin. When your trial ends you will be automatically upgraded to your chosen plan. Your reservation only last for 48 hours upon which your site name will become available again.</p><p>Please use the form below to setup your payment information.</p>', 'psts') . '</div>', $site_name);
                     } else {
                         // Non-recurring sites really should not do anything at checkout other than activate.
                         $result = ProSites_Helper_Registration::activate_blog($blog_data, true, $period, $level);
                         $blog_id = $result['blog_id'];
                         if (isset($result['password'])) {
                             $blog_data['new_blog_details']['user_pass'] = $result['password'];
                         }
                         ProSites_Helper_Registration::set_trial($blog_id, 1);
                         //Update Activation Key for blog
                         ProSites_Helper_Registration::update_activation_key($blog_id, $blog_data['activation_key']);
                         $psts->record_stat($blog_id, 'signup');
                         $ajax_response['show_finish'] = true;
                         $ajax_response['finish_content'] = ProSites_View_Front_Gateway::render_payment_submitted($blog_data, true);
                     }
//.........这里部分代码省略.........
开发者ID:vilmark,项目名称:vilmark_main,代码行数:101,代码来源:Registration.php


示例14: session_start

 * @package WooFramework
 * @subpackage Template
 */
session_start();
if (isset($_SESSION["agent_no"])) {
    $agent_no = $_SESSION["agent_no"];
} else {
    wp_redirect("step1");
    exit;
}
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
    if ($_POST['create-web-confirm'] != 1) {
        $error_message = "<li>กรุณาติ๊กเพื่อยืนยันในการสร้างเว็บไซต์ส่วนตัวของคุณ และกดบันทึกข้อมูล</li>";
    } else {
        $_POST['blog'] = array("email" => $_SESSION["agent-email"], "domain" => $_SESSION['site-url'], "title" => '' . $_SESSION['site-url'] . '- by Srikrung');
        wpmu_validate_blog_signup($_POST['blog']['domain'], $_POST['blog']['title']);
        update_agent_info($_SESSION);
        create_microweb();
        $_SESSION['create-web-finish'] = true;
        wp_redirect("step-finish");
        exit;
    }
}
function update_agent_info($agent_data)
{
    $agent = get_user_from_agent_no($agent_data["agent_no"]);
    $user_id = $agent->ID;
    if ($user_id) {
        $user_id = wp_update_user(array("ID" => $user_id, "user_email" => $agent_data['agent-email']));
        // update agent user meta data.
        update_user_meta($user_id, "agent-first", $agent_data['agent-first']);
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:31,代码来源:template-create-web-step4.php


示例15: wpmu_activate_signup

function wpmu_activate_signup($key)
{
    global $wpdb;
    $signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->signups} WHERE activation_key = %s", $key));
    if (empty($signup)) {
        return new WP_Error('invalid_key', __('Invalid activation key.'));
    }
    if ($signup->active) {
        return new WP_Error('already_active', __('The blog is already active.'), $signup);
    }
    $meta = unserialize($signup->meta);
    $user_login = $wpdb->escape($signup->user_login);
    $user_email = $wpdb->escape($signup->user_email);
    wpmu_validate_user_signup($user_login, $user_email);
    $password = generate_random_password();
    $user_id = username_exists($user_login);
    if (!$user_id) {
        $user_id = wpmu_create_user($user_login, $password, $user_email);
    } else {
        $user_already_exists = true;
    }
    if (!$user_id) {
        return new WP_Error('create_user', __('Could not create user'), $signup);
    }
    $now = current_time('mysql', true);
    if (empty($signup->domain)) {
        $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
        if (isset($user_already_exists)) {
            return new WP_Error('user_already_exists', __('That username is already activated.'), $signup);
        }
        wpmu_welcome_user_notification($user_id, $password, $meta);
        if (get_site_option('dashboard_blog') == false) {
            add_user_to_blog('1', $user_id, get_site_option('default_user_role', 'subscriber'));
        } else {
            add_user_to_blog(get_site_option('dashboard_blog'), $user_id, get_site_option('default_user_role', 'subscriber'));
        }
        add_new_user_to_blog($user_id, $user_email, $meta);
        do_action('wpmu_activate_user', $user_id, $password, $meta);
        return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
    }
    wpmu_validate_blog_signup($signup->domain, $signup->title);
    $blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid);
    // TODO: What to do if we create a user but cannot create a blog?
    if (is_wp_error($blog_id)) {
        // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
        // setting the activation flag.  Let's just set the active flag and instruct the user to reset their password.
        if ('blog_taken' == $blog_id->get_error_code()) {
            $blog_id->add_data($signup);
            $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
        }
        return $blog_id;
    }
    $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
    wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
    do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta);
    return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:57,代码来源:wpmu-functions.php


示例16: generate_new_blogid

 private function generate_new_blogid()
 {
     $blog_title = __('Migrated site (from UpdraftPlus)', 'updraftplus');
     if (empty($_POST['updraftplus_migrate_blogname'])) {
         $this->getinfo_form();
         return false;
     }
     // Verify value given
     $result = wpmu_validate_blog_signup($_POST['updraftplus_migrate_blogname'], $blog_title);
     if (count($result['errors']) > 0 && $result['errors']->get_error_code()) {
         if (is_wp_error($result['errors'])) {
             $err_msg = '<ul style="list-style: disc inside;">';
             foreach ($result['errors']->get_error_messages() as $key => $msg) {
                 $err_msg .= '<li><strong>' . __('Error:', 'updraftplus') . '</strong> ' . htmlspecialchars($msg) . '</li>';
             }
             $err_msg .= '</ul>';
         }
         if (isset($err_msg)) {
             $this->getinfo_form($err_msg, $_POST['updraftplus_migrate_blogname']);
             return false;
         }
     }
     $blogname = $_POST['updraftplus_migrate_blogname'];
     global $wpdb;
     if (domain_exists($result['domain'], $result['path'], $wpdb->siteid)) {
         // A WordPress-native string
         $this->getinfo_form(__('<strong>ERROR</strong>: Site URL already taken.'), $_POST['updraftplus_migrate_blogname']);
         return false;
     }
     $create = create_empty_blog($result['domain'], $result['path'], $blog_title, $wpdb->siteid);
     if (is_integer($create)) {
         $url = untrailingslashit($result['domain'] . $result['path']);
         echo '<strong>' . __('New site:', 'updraftplus') . '</strong> ' . $url . '<br>';
         // Update record of what we want to rewrite the URLs to in the search/replace operation
         // TODO: How to detect whether http or https???
         $this->siteurl = 'http://' . $url;
         // ???
         $this->home = 'http://' . $url;
         return $create;
     } else {
         $this->getinfo_form(print_r($create, true), $_POST['updraftplus_migrate_blogname']);
         return false;
     }
 }
开发者ID:beyond-z,项目名称:braven,代码行数:44,代码来源:migrator.php


示例17: printf


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpmu_validate_user_signup函数代码示例发布时间:2022-05-23
下一篇:
PHP wpmu_update_blogs_date函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap