Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#8350 closed enhancement (fixed)

Support extra $args in `load_template()`

Reported by: dcavins's profile dcavins Owned by: dcavins's profile dcavins
Milestone: 7.0.0 Priority: normal
Severity: normal Version: 6.2.0
Component: Core Keywords: has-patch commit
Cc: dcavins

Description

Thanks to some changes in WP 5.5 (https://make.wordpress.org/core/2020/07/17/passing-arguments-to-template-files-in-wordpress-5-5/), it's now possible to pass extra arguments to a template file. We use load_template() (https://developer.wordpress.org/reference/functions/load_template/) in bp_locate_template(), and the attached patch supports the passing of an extra $args parameter through our template functions to load_template().

Attachments (3)

8350.01.diff (5.0 KB) - added by dcavins 4 years ago.
Support the passing of an extra $args parameter through our template functions to load_template().
8350.02.patch (7.6 KB) - added by imath 4 years ago.
8350.03.patch (7.8 KB) - added by imath 4 years ago.

Download all attachments as: .zip

Change History (8)

@dcavins
4 years ago

Support the passing of an extra $args parameter through our template functions to load_template().

#1 @imath
4 years ago

  • Milestone changed from Awaiting Review to 7.0.0

That’s a really great idea 💡 👌!

Thanks for thinking about it 😍

@imath
4 years ago

#2 follow-up: @imath
4 years ago

  • Keywords commit added

Hi @dcavins patch looks good, I just suggested to also add the $args argument to bp_buffer_template_part and I've added a unit test about it.

#3 in reply to: ↑ 2 @dcavins
4 years ago

Replying to imath:

Hi @dcavins patch looks good, I just suggested to also add the $args argument to bp_buffer_template_part and I've added a unit test about it.

Fantastic! Great addition and the unit test is clever!

One comment: Can we mark this test as only applying to WP >=5.5? I'm afraid that Travis's test matrix would fail it because it won't work in WP 5.4 and below.

Last edited 4 years ago by dcavins (previous) (diff)

#4 @imath
4 years ago

  • Keywords dev-feedback removed

You're right! Sorry I haven't paid attention to your concern about unit test the first time I've read your comment. I agree with you. 8350.03.patch should make sure it won't happen.

Feel free to commit it ;)

@imath
4 years ago

#5 @dcavins
4 years ago

  • Owner set to dcavins
  • Resolution set to fixed
  • Status changed from assigned to closed

In 12726:

Pass extra args to template loading files.

Starting in WordPress 5.5, the template loading
functions will now allow additional arguments to be
passed through to the matched template file using a
new $args parameter.

This changeset passes an extra argument through
the BuddyPress template loading wrapper functions
to the underlying WordPress functions.

Props imath.

Fixes #8350.

Note: See TracTickets for help on using tickets.