Skip to content

Commit

Permalink
Merge pull request #123 from samiharju/master
Browse files Browse the repository at this point in the history
Fixed a bug in user-active.php caused by a change in WP core
  • Loading branch information
Miika Arponen committed Sep 20, 2019
2 parents 8ab75af + 5fdc766 commit 4e7fc1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed
- Fixed a bug in user-active.php caused by a change in WP core.

## [1.24.1] - 2019-08-20

### Fixed
Expand Down
17 changes: 14 additions & 3 deletions models/user-activate.php
Expand Up @@ -23,14 +23,25 @@ class UserActivate extends \DustPress\Model {
* @return $state (string) State of the view.
*/
public function State() {
if ( empty( $_GET['key'] ) && empty( $_POST['key'] ) ) {
// Get the key from cookie if set
$activate_cookie = 'wp-activate-' . COOKIEHASH;

if ( isset( $_COOKIE[ $activate_cookie ] ) ) {
$key = $_COOKIE[ $activate_cookie ];
}

if ( ! $key && empty( $_GET['key'] ) && empty( $_POST['key'] ) ) {
// activation key required
$state = "no-key";
$state = "no-key";
$this->print['title'] = __( 'Activation Key Required' );
$this->print['wp-activate-link'] = network_site_url( 'wp-activate.php' );
}
else {
$key = ! empty( $_GET['key'] ) ? $_GET['key'] : $_POST['key'];
// Get key from GET or POST if not set via cookie
if ( ! $key ) {
$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() ) {
Expand Down

0 comments on commit 4e7fc1b

Please sign in to comment.