Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 3 years ago

#3755 closed defect (bug) (fixed)

BP does not detect user blogs when users added to blog via Dashboard

Reported by: broniors's profile broniors Owned by:
Milestone: 1.5.2 Priority: normal
Severity: normal Version: 1.5.1
Component: Blogs Keywords:
Cc: broniors

Description

I am working on a move from a wordpress multisite to a new installation with wordpress/buddypress multisite. I have created the new multisite from scratch (including loading plugins) and I am only importing post,categories etc from xml files.

Wordpress 1.3.2
Buddypress 1.5.1

I think I have narrowed the problem to when a new users on a multisite are created and then use the system generated password they can not see the sites that they have ‘access’ to in the sites list on the admin bar or on the sites page. However if they go to the URL for the site (or the site’s admin) they have their appropriate level of access. I have found if they try and change their passwords through the front interface this does not fix the problem.

I have found that as a work-around if a admin person comes in and changes their password in the admin section of the website they can then see their sites in both the admin bar and the sites page. While this work-around is OK for now I am going to have problems with this when I move to having the system allow new users to be created by other people (and for themselves)

My testing

  1. I had the users created when I imported the posts. I found that users who were created this way could not see the ‘my sites’ section of the admin bar and could not see any of the sites they were assigned to … so I deleted all the posts. Created the users from scratch … reimported the content … and it appeared all to work …

until

  1. One user I created using the create new user and it sent the email with the password. The user can see the core site but not the sub-site they have access to under their site list. They could access the subsites just not see them in the admin bar or on the ‘sites’ page
  1. I however did not find the case for another test user I created where I created the user, did not send the email and typed in the password into the admin section.
  1. I have tried another senario. If create a new user … do not send the email … and set the password in admin. They can access all sites
  1. I have completed another senario. If I create a new users … do not send the email. Have them go to the website to ‘reset the password’. They then follow the link in the email and use the new password. It then allows them to login and takes them to the sub-site admin .. but it does not show the site under the sites dropdown in the admin bar and when you go to the sites page it does not show the sub-site.

This is a completely new user that has not accessed the site at all, has no posts assigned to it.

I have also had the user try to change their own password and this did not change the admin bar problem or show the sites on the ‘sites’ page.

6.I have found that with a new user if I create them in the admin, then set their password (but not tell them) … and then they go to forget password … and then log in … it all works perfectly.

Change History (12)

#1 @broniors
13 years ago

I have done some more testing. I have found that if the user goes to the admin (but this is only accessible from knowing the URL for the sub-site) and goes to their own profile and updates the password from the admin site. This rectifies the problem immediately. They do not need to login again.

#2 @boonebgorges
13 years ago

  • Component changed from Core to Blogs
  • Keywords needs-patch dev-feedback added
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from Multisite Buddypress - New Users, Sites, Admin Bar to BP does not detect user blogs when users added to blog via XML import
  • Version set to 1.5.1

It's probably the case that BP doesn't detect users being added to blogs via an XML post import. When you change the user's password, I think it's a roundabout way of forcing BP to reindex blogs for that user - you could probably change anything on the user's WP profile and it would have the same effect.

Try putting this inside of plugins/bp-custom.php, and refreshing your admin section one time:

function bbg_reset_blogs() {
  if ( is_super_admin() )
    bp_blogs_record_existing_blogs();
}
add_action( 'admin_init', 'bbg_reset_blogs' );

That will run the script that looks for existing blogs and adds them to BP users. Once you've verified that it's worked, comment out the add_action line or delete the whole block so that it doesn't run over and over again.

Your situation is an edge case, but it would be nice to fix at some point. Not sure of the best way to do it - dev feedback welcome.

Last edited 13 years ago by boonebgorges (previous) (diff)

#3 @broniors
13 years ago

  • Cc broniors added

#4 @broniors
13 years ago

Thanks for looking into this. Will test as soon as possible.

I have found with my testing earlier though it happens in 2 senarios

  1. Where users are created in the XML upload proces
  2. When you create a user in the admin (sub-site add user page) I add the username and the email address and it has the exact same problem with the admin bar, and sites.

I agree that the problem with the XML is not something that would happen often but I know with my site that I am expecting to add users regularly using the add user function (both myself and people using the

Last edited 13 years ago by broniors (previous) (diff)

#5 @broniors
13 years ago

I have done some additional testing. What I did was

  1. Create a new blog
  2. Add existing users to the new blog (without it sending a email for confirmation)
  3. sign in to the existing user account (with another browser) - the new blog does not appear in their list of sites on the 'sites' page or under sites on the admin bar
  4. I tested what you suggested above to change anything on their profile in the admin area. (i just added a space on the nickname) and then the user could see immediately the new site.

It looks like that there is a problem when users are added to blogs that BP does not get updated. Any changes to the users seems to facilitate this but the act of either creating the users or adding existing users to a blog doesn't appear to.

#6 @boonebgorges
13 years ago

  • Milestone changed from Future Release to 1.5.2
  • Summary changed from BP does not detect user blogs when users added to blog via XML import to BP does not detect user blogs when users added to blog via Dashboard

The only explanation I can really think of is that WP changed it so that the add_user_to_blog hook is no longer firing when it used to. I haven't got time to examine this right now, but here is the function in question: http://buddypress.trac.wordpress.org/browser/branches/1.5/bp-blogs/bp-blogs-functions.php#L299

If the problem is as general as broniors reports, then it should be fixed for the next release.

#7 @boonebgorges
13 years ago

OK. I've confirmed the bug, and found the culprit: http://buddypress.trac.wordpress.org/changeset/3836

Essentially, bp_blogs_add_user_to_blog() is defaulting to blog_id 1 when a $blog_id parameter is passed. I'm about to commit a fix for this logic.

#8 @boonebgorges
13 years ago

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

(In [5337]) Don't fall back on root_blog when blog_id is passed to bp_blogs_add_user_to_blog(). Fixes #3755

#9 @boonebgorges
13 years ago

(In [5338]) Don't fall back on root_blog when blog_id is passed to bp_blogs_add_user_to_blog(). Fixes #3755

#10 @broniors
13 years ago

Whoa! Thanks for all of your work to help get this resolved.

Adding users (both new and existing) from the admin panel is going to be a core process for my site. I really appreciate your efforts on this!!

#11 @broniors
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I think I have found something related to the bug above.

I have been testing using the workaround you have up up above. And even after I have done this and I have found for users that there is a problem with the way the blogs appear on blog lists with buddypress. I have found that when the following 2 pages load they do not list the blogs however when a change is made to the order (via dropdown) they do. I am not sure if it relates to the blogs being private but I thought it was wise to raise it.

Test user
username/password: sampleuser (this user was created via the front end and added to the sites from the admin)

This user should see 2 subblogs - Student 1 {Parent 1} and Student 2 {Parent 1}. This can be seen from the admin bar dropdown under sites. However when you go to either of the pages below. It just lists the default site. However if you change the dropdown on the ordered by from the default to something else ... they appear.

http://ipersonalshopper.com.au/sites/
http://ipersonalshopper.com.au/members/sampleuser/blogs/

For some reason when the pages load initially they don't appear with the sub-sites. I thought it might be possible that this might also relate to how they were added.

#12 @boonebgorges
13 years ago

  • Keywords needs-patch dev-feedback removed
  • Resolution set to fixed
  • Status changed from reopened to closed

This appears to be an unrelated issue. Can I ask you to open a separate ticket, please?

Note: See TracTickets for help on using tickets.