Skip to:
Content

BuddyPress.org

Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#7679 closed defect (bug) (fixed)

JS error in wp-admin "Extended Profile" blocking upload of profile photo

Reported by: DJPaul Owned by: slaFFik
Milestone: 3.0 Priority: normal
Severity: major Version:
Component: Administration Keywords:
Cc:

Description

With trunk, accessing http://example.com/wp-admin/users.php?page=bp-profile-edit will print a JS error to console. This stops the "Edit Profile Photo" box loading.

https://i.imgur.com/GZfxr9A.png

This is a regression from the 2.9.x branch because this works there.

Change History (5)

#1 @DJPaul
20 months ago

My JS/Backbone is too weak to debug this.

#2 @boonebgorges
20 months ago

Broken in [11835].

In wp-admin, the Attachments module always tries to load the "default" templates, skipping the template hierarchy. I don't recall exactly why this was - I guess because wp-admin is not a themed area. See https://github.com/buddypress/BuddyPress/blob/f078caa1fa5a93e9bdb074f3e914633620858436/src/bp-core/bp-core-attachments.php#L928

The simple answer is to change 'bp-legacy' to 'shared'. But this alone doesn't work, because the file /src/bp-templates/shared/buddypress/assets/_attachments/avatars/index.php contains a reference to a bp_nouveau function. I think the right answer is to revert to the bp-legacy version of avatars/index.php in the 'shared' directory, and move the current avatars/index.php to bp-nouveau. This strategy needs sign-off from @hnla or @DJPaul, who probably understand this better than I do.

#3 @hnla
20 months ago

@boonebgorges This may relate to something I spotted after the asset dir move and while looking at the attachments in general trying to make some changes, we have a hardocoded reference to a path for admin templates that seemed out of place now and probably needed updating to something more dynamic to suit multi template packs or assets as 'shared' details are mentioned somewhere, haven't to hand at the moment, will try and look later.

#4 @djpaul
20 months ago

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

In 11839:

Templates: swap shared _attachments/avatars/index.php with Legacy version; fix path in wp-admin.

The Nouveau template was previously used, and included a call to a Nouveau-only function, which I missed in r11835.
The Nouveau pack now has a copy of its Nouveau template again.

Also changes a patch in bp_attachments_get_template_part() to support the changed location for this template asset.
This is used for the "Upload Avatar" screens in wp-admin Users > Edit.

Props boonebgorges, hnla.

Fixes #7679 and #7675

#5 @hnla
20 months ago

The only concern I have here is that the nouveau sets were in fact updated and as such 'better', I tended to like the approach taken to use the Nouveau set as default and retain legacy's as overloaded, I had/have been working through these templates trying to update some general aspects that aren't generally optimal but can't do that on the default set as used by legacy for the usual fears :( , but if we're working again alls well that ends well :(

Note: See TracTickets for help on using tickets.