Skip to:
Content

bbPress.org

Opened 3 years ago

Last modified 16 months ago

#3048 new defect

Better detection for symlinks in bbp_enqueue_style() and bbp_enqueue_script()

Reported by: r-a-y Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.5
Component: Appearance - Included Themes Keywords: has-patch needs-refresh dev-feedback needs-unit-tests
Cc:

Description

If the bbpress directory or WP_PLUGINS_DIR is symlinked, bbp_enqueue_style() and bbp_enqueue_script() has trouble calculating the asset's URL.

This is mostly due to those functions using the WP_CONTENT_DIR constant for replacement.

Attached patch does replacement from the plugins directory, stylesheet directory and template directory, instead of looking at WP_CONTENT_DIR.

Plugins directory is calculated from bbpress()->plugin_dir.

Attachments (1)

3048.01.patch (3.1 KB) - added by r-a-y 3 years ago.

Download all attachments as: .zip

Change History (7)

@r-a-y
3 years ago

#1 @johnjamesjacoby
3 years ago

Hey @r-a-y, thanks for this.

Did you test this with bbPress in mu-plugins, or some other directory like wp-content/bbp-plugins/bbpress?

Many installs (like WordPress.com) will have custom plugins locations, and bbPress (and BuddyPress too) need to continue to support them. It's also unlikely we have test cases for this yet, so I doubt anything would perk up there.

#2 @r-a-y
3 years ago

Sorry for the late reply.

I tested with symlinking the plugins directory locally, as well as on a webhost that has done the same thing (I'm guessing). The host in question is Red Hat OpenShift.

Also see #2739.

#3 follow-up: @johnjamesjacoby
3 years ago

  • Keywords needs-refresh dev-feedback added
  • Milestone changed from Awaiting Review to 2.7

I applied the patch, and it doesn't work with custom directories added to the bbp_get_template_stack().

I'd like to bump this to 2.7, only to help get 2.6 across the line. If we can work on this sooner than 2.7, that's a-OK.

#4 @netweb
3 years ago

  • Keywords needs-unit-tests added

I think some unit tests could be beneficial here also

This ticket was mentioned in Slack in #buddypress by r-a-y. View the logs.


16 months ago

#6 in reply to: ↑ 3 @r-a-y
16 months ago

Just getting back to this after this issue was talked about in Slack.

Replying to johnjamesjacoby:

I applied the patch, and it doesn't work with custom directories added to the bbp_get_template_stack().

Got any examples I could test with? Are your custom directories located outside the plugins directory?

Replying to netweb:

I think some unit tests could be beneficial here also

I'm not sure how unit tests could be written to test for different, custom-linked bbPress directories...

Last edited 16 months ago by r-a-y (previous) (diff)
Note: See TracTickets for help on using tickets.