Make WordPress Core

Ticket #25350: 25350.04.patch

File 25350.04.patch, 3.6 KB (added by boonebgorges, 11 years ago)
  • src/wp-activate.php

     
    5252add_action( 'wp_head', 'wpmu_activate_stylesheet' );
    5353
    5454get_header();
     55
     56//duplicate_hook
     57$key_param = apply_filters( 'wp_activate_key_param', 'k' );
     58
     59$activation_key = false;
     60if ( ! empty( $_REQUEST[ $key_param ] ) ) {
     61        $activation_key = urldecode( $_GET[ $key_param ] );
     62} else if ( ! empty( $_REQUEST['key'] ) ) {
     63        // Backward compatibility
     64        $activation_key = urldecode( $_REQUEST['key'] );
     65}
     66
    5567?>
    5668
    5769<div id="content" class="widecolumn">
    58         <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
     70        <?php if ( empty( $activation_key ) ) { ?>
    5971
    6072                <h2><?php _e('Activation Key Required') ?></h2>
    6173                <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
    6274                        <p>
    6375                            <label for="key"><?php _e('Activation Key:') ?></label>
    64                             <br /><input type="text" name="key" id="key" value="" size="50" />
     76                            <br /><input type="text" name="<?php echo esc_attr( $key_param ) ?>" id="key" value="" size="50" />
    6577                        </p>
    6678                        <p class="submit">
    6779                            <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
     
    7082
    7183        <?php } else {
    7284
    73                 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
    74                 $result = wpmu_activate_signup($key);
     85                $result = wpmu_activate_signup( $activation_key );
    7586                if ( is_wp_error($result) ) {
    7687                        if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
    7788                            $signup = $result->get_error_data();
     
    116127        var key_input = document.getElementById('key');
    117128        key_input && key_input.focus();
    118129</script>
    119 <?php get_footer(); ?>
    120  No newline at end of file
     130<?php get_footer(); ?>
  • src/wp-includes/ms-functions.php

     
    714714        if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
    715715                return false;
    716716
     717        /**
     718         * Filter the URL parameter to use for activation keys
     719         *
     720         * @since 3.7.0
     721         * @param string The activation key parameter.
     722         */
     723        $key_param = apply_filters( 'wp_activate_key_param', 'k' );
     724
    717725        // Send email with activation link.
    718726        if ( !is_subdomain_install() || $current_site->id != 1 )
    719                 $activate_url = network_site_url("wp-activate.php?key=$key");
     727                $activate_url = network_site_url("wp-activate.php?$key_param=$key");
    720728        else
    721                 $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
     729                $activate_url = "http://{$domain}{$path}wp-activate.php?$key_param=$key"; // @todo use *_url() API
    722730
    723731        $activate_url = esc_url($activate_url);
    724732        $admin_email = get_site_option( 'admin_email' );
     
    773781        if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
    774782                return false;
    775783
     784        //duplicate_hook
     785        $key_param = apply_filters( 'wp_activate_key_param', 'k' );
     786
    776787        // Send email with activation link.
    777788        $admin_email = get_site_option( 'admin_email' );
    778789        if ( $admin_email == '' )
     
    784795                        __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
    785796                        $user, $user_email, $key, $meta
    786797                ),
    787                 site_url( "wp-activate.php?key=$key" )
     798                site_url( "wp-activate.php?$key_param=$key" )
    788799        );
    789800        // TODO: Don't hard code activation link.
    790801        $subject = sprintf(