Skip to:
Content

BuddyPress.org

Opened 2 years ago

Closed 2 years ago

#7448 closed defect (bug) (fixed)

Trailing slash needed for URLs for compatibility with LiteSpeed

Reported by: allianse Owned by: r-a-y
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.0
Component: Core Keywords: has-patch
Cc: support@…

Description (last modified by johnjamesjacoby)

There is a problem for accept a friend with Bosstheme and LiteSpeed Web Server

Please find the file attached with modified lines:

/**
 * ORIGINAL SCRIPT
 */
 //return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id, 'friends_accept_friendship' ), $friendship_id );
/**
 * UPDATED SCRIPT (23-FEB-2017)
 * To avoid the Accept request URL issue 
 */
return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id.'/', 'friends_accept_friendship' ), $friendship_id );

Please modify the file before release next update

Regards

Attachments (3)

bp-friends-template.php (22.8 KB) - added by allianse 2 years ago.
bp-friends-template.php
7448.01.patch (1.3 KB) - added by r-a-y 2 years ago.
7448.02.patch (12.5 KB) - added by r-a-y 2 years ago.

Download all attachments as: .zip

Change History (13)

@allianse
2 years ago

bp-friends-template.php

#1 @allianse
2 years ago

  • Component changed from Core to Friends
  • Milestone changed from 2.8.1 to 2.8.2

#2 @allianse
2 years ago

  • Cc support@… added

#3 @r-a-y
2 years ago

  • Keywords has-patch added
  • Milestone changed from 2.8.2 to 2.9

Hi,

Thanks for the report. It looks like you added a trailing slash to the end of the accept friendship URL.

Since this behavior isn't a regression from a change we made in v2.8.0, this fix will have to wait until v2.9.0.

In the meantime, you can fix this without touching core code by adding the following to your theme's functions.php or wp-content/plugins/bp-custom.php:

add_filter( 'bp_get_friend_accept_request_link', 'trailingslashit' );
add_filter( 'bp_get_friend_reject_request_link', 'trailingslashit' );

It might also be possible to address this in your config for LiteSpeed to add a trailingslash to all URLs.


Devs: This might be a good chance to audit all other similar links.

#7449 was marked as a duplicate.

Last edited 2 years ago by r-a-y (previous) (diff)

@r-a-y
2 years ago

#4 @r-a-y
2 years ago

  • Summary changed from buddypress/bp-friends/bp-friends-template.php to Trailing slash needed for URLs for compatibility with LiteSpeed

@r-a-y
2 years ago

#5 @r-a-y
2 years ago

  • Component changed from Friends to Core

I've audited all our template link functions to add a trailing slash where necessary.

Question: We use a mis-mash of either trailingslashit() vs. simply adding a / to the end of a link. Which one do we prefer?

In 02.patch, I've opted to use trailingslashit(), but let me know if you have any issue with this.

Last edited 2 years ago by r-a-y (previous) (diff)

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


2 years ago

#7 @johnjamesjacoby
2 years ago

I think this should patch should use user_trailingslashit(), which does the trailing slash based on the permalink rules.

#8 @johnjamesjacoby
2 years ago

  • Description modified (diff)

(Editing the formatting of the original report a bit.)

#9 @r-a-y
2 years ago

I think this should patch should use user_trailingslashit(), which does the trailing slash based on the permalink rules.

user_trailingslashit() would make sense if we supported rewrite rules.

I think when we ever get to rewrite rules, we can switch everything to use user_trailingslashit(), until then perhaps we can stick with trailingslashit().

#10 @r-a-y
2 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 11598:

Audit template link functions to use trailingslashit() where necessary.

Particularly, fixes issues on LightSpeed installs.

Props allianse, r-a-y.

Fixes #7448.

Note: See TracTickets for help on using tickets.