Skip to:
Content

BuddyPress.org

Opened 15 years ago

Closed 13 years ago

#2350 closed defect (bug) (fixed)

Add user to blog in console

Reported by: motomac's profile motomac Owned by:
Milestone: 1.6 Priority: normal
Severity: minor Version:
Component: Core Keywords: needs-patch
Cc:

Description

WPMU+BP
If I want to add my friend to my blog adding a new unregistered user in console (/wp-admin/user-new.php), my friend recieved an invitation mail with a link like: http://abc.com/wp-activate.php?key=8d4acfd2530dcae2&e=1

It doesn't work.

Attachments (3)

patch-2350.patch (1000 bytes) - added by DJPaul 15 years ago.
patch-2350-2.patch (1.1 KB) - added by DJPaul 15 years ago.
patch-2350-2.2.patch (1.1 KB) - added by DJPaul 15 years ago.

Download all attachments as: .zip

Change History (26)

#1 @boonebgorges
15 years ago

  • Keywords reporter-feedback added; invite registration wpmu removed

The URL you give is a WPMU activation URL. BP activation URLs are of the form abc.com/activate?key=xyz.

A test on WPMU 2.9.2 + BP 1.2.3 shows that BP is correctly filtering the WPMU address and changing it into the BP address. Is this the configuration where you're experiencing the problem? Are you inviting users to the main blog (where BP is running) or to a secondary blog?

#2 @motomac
15 years ago

If I add user to main blog, my friend have recieved a right link:

http://abc.com/activate?key=217e4806f7f43bb5&e=1

and registration works fine (but without filling bp registration form).

But if I add user to secondary blog, a have an error link in activaction mail

http://abc.com/wp-activate.php?key=8d4acfd2530dcae2&e=1 

#3 @DJPaul
15 years ago

Is BuddyPress activated site-wide or just on the main blog?

#4 @DJPaul
15 years ago

duplicate of #1610, it seems

#5 @DJPaul
15 years ago

Confirmed on non-main blog 'add user' via wp-admin on BP 1.2 branch and WP 3.0 rev 14326. Working on a patch...

@DJPaul
15 years ago

#6 @DJPaul
15 years ago

  • Keywords has-patch tested added; reporter-feedback removed

On a WPMU BP site, you want user registration and user activation to happen on the BP_ROOT_BLOG. The BP functions which send the user account activation email do not handle this situation correctly when an Admin adds a user via the wp-admin backend on a blog which isn't the BP_ROOT_BLOG.

The locate_template calls look for activate.php or /registration/activate.php on this non-BP_ROOT_BLOG, and unless this blog contains that file (i.e. most probably running a BP theme), it falls back to the standard wp-active.php. Attached is a patch which duplicates some of the locate_template logic because constants can't be redefined (obviously).

#7 @apeatling
15 years ago

Can we do this without switch_to_blog()?

#8 @DJPaul
15 years ago

get_stylesheet_directory() -> get_stylesheet() -> apply_filters('stylesheet', get_option('stylesheet'))

I'll have a look after work but I think the get_blog_prefix() call within switch_to_blog() is where the magic happens.

#9 @DJPaul
15 years ago

Take a look at patch-2350-2.2.patch (the other one had debug code).

#10 @apeatling
15 years ago

Just tested the original problem and it works ok for me. The URL will only be /activate/ if a BuddyPress theme is activated and it has a custom activation template. It should just be the standard wp-activate.php link otherwise.

#11 @apeatling
15 years ago

This was on 1.2.4-pre and WPMU 2.9.2. Testing now on 3.0 latest.

#12 @DJPaul
15 years ago

As per previous comment:
On a WPMU BP site, you want user registration and user activation to happen on the BP_ROOT_BLOG. The BP functions which send the user account activation email do not handle this situation correctly when an Admin adds a user via the wp-admin backend on a blog which isn't the BP_ROOT_BLOG.... which doesn't run a BP-specific theme (and why should it? That's the whole point of multisites. Different blogs for different users).

I view this is as a valid use case.

#13 follow-up: @apeatling
15 years ago

Why should all registrations be handled on the root blog? That seems like a bad idea and is fundimentally messing with the way WPMU works. If a user has a blog and settings allow, they should be able to add users via their blog and activate them via their blog.

#14 @apeatling
15 years ago

fundamentally. ;)

#15 @apeatling
15 years ago

  • Milestone changed from 1.2.4 to 1.3
  • Priority changed from major to normal

#16 @paulhastings0
14 years ago

  • Summary changed from Add user to blog in console to [patch] Add user to blog in console

#17 in reply to: ↑ 13 @andrea_r
14 years ago

Replying to apeatling:

Why should all registrations be handled on the root blog? That seems like a bad idea and is fundimentally messing with the way WPMU works.

I hate to disagree, but adding new users to the network always has to happen on the main blog. And it always did. This was how WPMU works, and how multisite works. Users gets added to the network via the main blog.

If a user has a blog and settings allow, they should be able to add users via their blog and activate them via their blog.

Once a user is a part of the network and has activated their account, users can add other users to their blog if this is enabled. If they are not part of the network, they will still get a link to the main blog.

Always did, always will. Think of how wordpress.com works. ;)

#18 @DJPaul
14 years ago

  • Keywords needs-patch added; has-patch tested removed
  • Milestone changed from 1.3 to 1.4
  • Summary changed from [patch] Add user to blog in console to Add user to blog in console

Punting this to 1.4 unless someone contributes an updated patch :) I think patch-2350-2.2.patch was in the right direction, but it will require re-testing to validate.

#19 @boonebgorges
13 years ago

  • Keywords close added
  • Severity set to normal

I'm a bit confused about the purpose of this ticket. If it's to change the way that WPMS registration works, then it's either plugin territory, or it should be taken upstream to WordPress. If it's to provide fallback support when a theme does not have the proper registration templates, then we probably should be having a broader discussion about whether BP should be doing this for *all* templates, not just those involved in registration. DJPaul's patch (if I'm understanding it correctly) kinda skirts the issue; it makes it appear like you can register on a secondary blog, but your registration emails etc will still come from the main WP site.

BTW, does anyone know what happens with respect to registration emails when BP_ROOT_BLOG != 1? Too lazy to test :)

#20 @DJPaul
13 years ago

The issue was that, in multisite, adding a user via wp-admin to the non-root-blog generated an invalid user activation URL in the email. It points to that site's wp-activate.php instead of BP's root blog's /activate= handler.

All this needs testing and reconfirming as this ticket is pre-WP 3.0.

I'm still of the opinion that user activation link should go to the BP root blog, unless the BP multiblog setting is enabled.

#21 @boonebgorges
13 years ago

  • Keywords close removed
  • Severity changed from normal to minor

I'm still of the opinion that user activation link should go to the BP root blog, unless the BP multiblog setting is enabled.

Agreed.

adding a user via wp-admin

OK, I understand it a bit better with the addition of this piece of info (I lost that point above). Probably just a matter of filtering the email content.

#22 @DJPaul
13 years ago

See also #3467

#23 @boonebgorges
13 years ago

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

(In [5366]) Deprecates bp_has_custom_activation_page() in favor of checking bp_pages for an activation page. Retools bp_get_activation_page() so that it returns the proper network registration page when adding users from a non-root Dashboard. Fixes #2350

Note: See TracTickets for help on using tickets.