WordPress:WPMU Admin Confirmed Username Before Able To Blog

来自站长百科
跳转至: 导航、​ 搜索

Code for WordPressMU Administration confirmed username before the blogger is able to start blogging.

博客用户开始写博客之前,WordPressMU管理员用来确认用户名的密码。


rcsdiff -C 5 -r1.1 wp-signup.php
===================================================================
RCS file: wp-signup.php,v
retrieving revision 1.1
diff -C 5 -r1.1 wp-signup.php
*** wp-signup.php       2007/07/25 03:43:23     1.1
--- wp-signup.php       2007/08/27 19:46:27
***************
*** 154,183 ****
        // allow definition of default variables
        $filtered_results = apply_filters('signup_another_blog_init', array('blog_id' => $blog_id, 'blog_title' => $blog_title, 'errors' => $errors ));
        $blog_id = $filtered_results['blog_id'];
        $blog_title = $filtered_results['blog_title'];
        $errors = $filtered_results['errors'];

!       echo '<h2>' . sprintf( __('Get <em>another</em> %s blog in seconds'), $current_site->site_name ) . '</h2>';

        if ( $errors->get_error_code() ) {
                echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>";
        }

  ?>
! <p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p>
  <?php
!       $blogs = get_blogs_of_user($current_user->ID);
!
!       if ( ! empty($blogs) ) {
                ?><p><?php _e('Here are the blogs you already have:') ?></p><ul><?php
!               foreach ( $blogs as $blog )
!                       echo "<li><a href='http://" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>";
                ?></ul><?php
        }
  ?>
! <p><?php _e("If you’re not going to use a great blog domain, leave it for a new user. Now have at it!") ?></p>
  <form name="setupform" id="setupform" method="post" action="wp-signup.php">
  <input type="hidden" name="stage" value="gimmeanotherblog" />
  <?php do_action( "signup_hidden_fields" ); ?>
  <table border="0" width="100%" cellpadding="9">
  <?php
--- 154,194 ----
        // allow definition of default variables
        $filtered_results = apply_filters('signup_another_blog_init', array('blog_id' => $blog_id, 'blog_title' => $blog_title, 'errors' => $errors ));
        $blog_id = $filtered_results['blog_id'];
        $blog_title = $filtered_results['blog_title'];
        $errors = $filtered_results['errors'];
+
+       $blogs = get_blogs_of_user($current_user->ID);
+       $domains = "";
+       foreach ($blogs as $blog) {
+         if ($blog->userblog_id != 1) {
+           $domains .= "<li><a href='http://" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>\n";
+         }
+       }
+
+       if ($domains) {
+         $add_a = "<strong>another</strong>";
+       } else {
+         $add_a = "a";
+       }

!       echo '<h2>' . sprintf( __('Get %s %s blog'), $add_a, $current_site->site_name ) . '</h2>';

        if ( $errors->get_error_code() ) {
                echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>";
        }

  ?>
! <p><?php printf(__("Welcome back, %s. By filling out the form below, you can add $add_a blog to your account."), $current_user->display_name) ?></p>
  <?php
!    if ( $domains ) {
                ?><p><?php _e('Here are the blogs you already have:') ?></p><ul><?php
!                    print $domains;
                ?></ul><?php
        }
  ?>
! <p><?php _e("If you’re not going to use a great blog domain, please leave it for a new user.") ?></p>
  <form name="setupform" id="setupform" method="post" action="wp-signup.php">
  <input type="hidden" name="stage" value="gimmeanotherblog" />
  <?php do_action( "signup_hidden_fields" ); ?>
  <table border="0" width="100%" cellpadding="9">
  <?php
***************
*** 252,264 ****
  <input id="signupblog" type="hidden" name="signup_for" value="user" />
  <?php } else { ?>
  <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup[ 'blog' ] ?> />
  <label for="signupblog"><?php _e('Give me a blog please!') ?></label>
  <br />
! <!-- <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup[ 'user' ] ?> />
  <label for="signupuser"><?php _e('Just a username, please.') ?></label>
- -->
  <?php } ?>
  </p>
  </td>
  </tr>
  <tr>
--- 263,274 ----
  <input id="signupblog" type="hidden" name="signup_for" value="user" />
  <?php } else { ?>
  <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup[ 'blog' ] ?> />
  <label for="signupblog"><?php _e('Give me a blog please!') ?></label>
  <br />
! <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup[ 'user' ] ?> />
  <label for="signupuser"><?php _e('Just a username, please.') ?></label>
  <?php } ?>
  </p>
  </td>
  </tr>
  <tr>
***************
*** 395,411 ****
                validate_another_blog_signup();
                break;
        default :
                $user_email = $_POST[ 'user_email' ];
                do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
!               if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
!                       signup_another_blog($newblogname);
!               } elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
!                       signup_user( $newblogname, $user_email );
                } else {
!                       _e( "You're logged in already. No need to register again!" );
!               }

                if ($newblogname) {
                        if( constant( "VHOST" ) == 'no' )
                                $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/';
                        else
--- 405,420 ----
                validate_another_blog_signup();
                break;
        default :
                $user_email = $_POST[ 'user_email' ];
                do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
!
!               if( is_user_logged_in() == false) {
!                 signup_user( $newblogname, $user_email );
                } else {
!                 signup_another_blog($newblogname);
!               }

                if ($newblogname) {
                        if( constant( "VHOST" ) == 'no' )
                                $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/';
                        else
[wikiconsul@host wp-includes]$ rcsdiff -r1.1 -C5 wpmu-functions.php
===================================================================
RCS file: wpmu-functions.php,v
retrieving revision 1.1
diff -C5 -r1.1 wpmu-functions.php
*** wpmu-functions.php  2007/07/20 13:42:54     1.1
--- wpmu-functions.php  2007/08/28 18:11:11
***************
*** 1111,1137 ****
        }
        $admin_email = get_site_option( "admin_email" );
        if( $admin_email == '' )
                $admin_email = 'support@' . $_SERVER[ 'SERVER_NAME' ];
        $message_headers = "MIME-Version: 1.0\n" . "From: " . get_site_option( "site_name" ) .  " <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
!       $message = sprintf(__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s"), $activate_url, "http://{$domain}{$path}");
        // TODO: Don't hard code activation link.
        $subject = sprintf(__('Activate %s'), $domain.$path);
!       wp_mail($user_email, $subject, $message, $message_headers);
  }

  function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
        global $current_site;
        // Send email with activation link.
        $admin_email = get_site_option( "admin_email" );
        if( $admin_email == '' )
                $admin_email = 'support@' . $_SERVER[ 'SERVER_NAME' ];
        $message_headers = "MIME-Version: 1.0\n" . "From: " . get_site_option( "site_name" ) .  " <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
!       $message = sprintf(__("To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n"), "http://{$current_site->domain}{$current_site->path}wp-activate.php?key=$key" );
        // TODO: Don't hard code activation link.
        $subject = sprintf(__('Activate %s'), $user);
!       wp_mail($user_email, $subject, $message, $message_headers);
  }

  function wpmu_activate_signup($key) {
        global $wpdb;

--- 1111,1137 ----
        }
        $admin_email = get_site_option( "admin_email" );
        if( $admin_email == '' )
                $admin_email = 'support@' . $_SERVER[ 'SERVER_NAME' ];
        $message_headers = "MIME-Version: 1.0\n" . "From: " . get_site_option( "site_name" ) .  " <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
!       $message = sprintf(__("To activate $user_email's blog ($user), please click the following link:\n\n%s\n\nAfter you activate, they will receive *another email* with your login.\n\nAfter you activate, you can visit the blog here:\n\n%s"), $activate_url, "http://{$domain}{$path}");
        // TODO: Don't hard code activation link.
        $subject = sprintf(__('Activate %s'), $domain.$path);
!       wp_mail($admin_email, $subject, $message, $message_headers);
  }

  function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
        global $current_site;
        // Send email with activation link.
        $admin_email = get_site_option( "admin_email" );
        if( $admin_email == '' )
                $admin_email = 'support@' . $_SERVER[ 'SERVER_NAME' ];
        $message_headers = "MIME-Version: 1.0\n" . "From: " . get_site_option( "site_name" ) .  " <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
!       $message = sprintf(__("To activate $user_email ($user) user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n"), "http://{$current_site->domain}{$current_site->path}wp-activate.php?key=$key" );
        // TODO: Don't hard code activation link.
        $subject = sprintf(__('Activate %s'), $user);
!       wp_mail($admin_email, $subject, $message, $message_headers);
  }

  function wpmu_activate_signup($key) {
        global $wpdb;

***************