Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29191 closed defect (bug) (fixed)

Notice when activating an account on a multisite config

Reported by: imath's profile imath Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Networks and Sites Keywords: needs-patch
Focuses: multisite Cc:



Since [28373], when a user clicks on the account activation url (eg: site.url/wp-activate.php?key=key) from the activation email he received, the activation page is throwing a notice:
Notice: Undefined index: blog_id in path_to\wp-activate.php on line 108

Applying the diff attached to this ticket seems to avoid this notice.

Attachments (1)

29191.diff (1.0 KB) - added by imath 10 years ago.

Download all attachments as: .zip

Change History (7)

10 years ago

#1 @imath
10 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.0

#3 @DrewAPicture
10 years ago

  • Keywords needs-patch added; has-patch removed

I don't think 29191.diff addresses the wider issue of why blog_id would be set but null. We know, for instance, that blog_id is directly set in the $result array returned from wpmu_activate_signup(), So the problem has to be in wpmu_create_blog() or further down the line.

As many Multisite functions simply fallback to the current blog ID when $blog_id is null, it's not surprising this just popped up after removing the extract() in [28373].

#4 @imath
10 years ago

If it can help, i think i should detail a bit more how i got the notice.

I've added a new user from the /wp-admin/user-new.php of the root blog of the network. In this screen the form let you set the login, the mail, the role and whether to skip confirmation email or not. I've left the noconfirmation checkbox empty.

So i think, in this case, that wpmu_signup_blog() is not used but only wpmu_signup_user().

Then the email was sent to the user. And when the user clicks on the activation link, he arrives on /wp-activate.php and gets his login, password..

I think, in my case, that wpmu_activate_signup() stops at line 1038 with :
return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );

So no blog_id argument in the returned array.

Version 0, edited 10 years ago by imath (next)

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

10 years ago

#6 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 29554:

wpmu_activate_signup() returns an array or WP_Error. The array keys it returns can be different based on context of $signup. The return value was previously extract()'d, so the value of $blog_id was secretly undefined when being passed to get_blogaddress_by_id() in some cases.

If $result['blog_id'] is not set, make sure $url is set to an empty string so that the proper "activated" message is shown to the user.

Props imath.
See [28373].
Fixes #29191.

Note: See TracTickets for help on using tickets.