Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#7675 closed defect (bug) (fixed)

Check bp_attachments_get_template_part() & revise it's hardcoded template directory

Reported by: hnla's profile hnla Owned by: djpaul's profile djpaul
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Templates Keywords:
Cc:

Description

This is just to highlight something we perhaps need to examine and relates partly to the recent relocation of the assets dir in themes ( #7672 )

In bp-core/bp-core-attachements.php we run a function bp_attachements_get_template_part($slug) L: 923 to locate the part required.

Normally it will return bp_get_template_part( $attachment_template_part ) e.g assets/_attachments/upload.php`

I assume - as things appear ok with the change - this returns new location ok.

However in the function we test for is_admin() to load parts for admin screens and this is to some extent hardcoded to 'legacy' e.g:
$attachment_admin_template_part = buddypress()->themes_dir . '/bp-legacy/buddypress/' . $attachment_template_part . '.php'

While that will work as we preserved the assets dir in legacy, do we want to locate parts from legacy by default?

Change History (5)

#1 @DJPaul
7 years ago

  • Milestone changed from Awaiting Review to Under Consideration

I need to review where/how this is being used in the admin, but I'd guess we want to use the appropriate template functions to fetch the right template from the stack, rather than hardcode a path.

Good find!

#2 @DJPaul
7 years ago

This is used by the Extended Profiles tab of the wp-admin edit user screen, though I can't test what loading the Nouveau template part here looks like because it turns out this box is broken on trunk at the moment: #7679

Let's revisit this once that's working.

#3 @DJPaul
7 years ago

  • Milestone changed from Under Consideration to 3.0

#4 @DJPaul
7 years ago

  • Component changed from Media to Templates

#5 @djpaul
7 years ago

  • Owner set to djpaul
  • 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

Note: See TracTickets for help on using tickets.