Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 9 years ago

#7448 closed defect (bug) (fixed)

Trailing slash needed for URLs for compatibility with LiteSpeed

Reported by: allianse Owned by: r-a-y
Priority: normal Milestone: 2.9
Component: Core Version: 2.8.0
Severity: normal 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 10 years ago.
bp-friends-template.php
7448.01.patch (1.3 KB ) - added by r-a-y 10 years ago.
7448.02.patch (12.5 KB ) - added by r-a-y 9 years ago.

Download all attachments as: .zip

Change History (13)

@allianse
10 years ago

bp-friends-template.php

#1 @allianse
10 years ago

  • Component CoreFriends
  • Milestone 2.8.12.8.2

#2 @allianse
10 years ago

  • Cc support@… added

#3 @r-a-y
10 years ago

  • Keywords has-patch added
  • Milestone 2.8.22.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.

Version 2, edited 10 years ago by r-a-y (previous) (next) (diff)

@r-a-y
10 years ago

#4 @r-a-y
10 years ago

  • Summary buddypress/bp-friends/bp-friends-template.phpTrailing slash needed for URLs for compatibility with LiteSpeed

@r-a-y
9 years ago

#5 @r-a-y
9 years ago

  • Component FriendsCore

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 9 years ago by r-a-y (previous) (diff)

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


9 years ago

#7 @johnjamesjacoby
9 years ago

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

#8 @johnjamesjacoby
9 years ago

  • Description modified (diff)

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

#9 @r-a-y
9 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
9 years ago

  • Owner set to r-a-y
  • Resolutionfixed
  • Status newclosed

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.