#2831 closed task (blessed) (fixed)
Duplicated code for user profile URL's
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.6 | Priority: | normal |
| Severity: | normal | Version: | 2.1 |
| Component: | Component - Users | Keywords: | has-patch |
| Cc: |
Description
While fixing #2828, I noticed we still have lots of duplicated code for generating profile URL's that do a bunch of funky string replacements. Let's update all of these to use bbp_get_user_profile_url() like their PHPDoc headers say they do.
Attachments (4)
Change History (11)
#2
@
11 years ago
- Owner set to johnjamesjacoby
- Resolution set to fixed
- Status changed from new to closed
In 5815:
This ticket was mentioned in Slack in #bbpress by thebrandonallen. View the logs.
11 years ago
#5
@
11 years ago
New patches. Below is the description of their fixes.
attachment:2831.03.patch
The function home_url() is ignorant of it's passed data, except to make sure it's a string. So, if you take the string 'yikes' and treat it like this home_url( home_url( home_url( 'yikes' ) ) ), you'll get something like this in return http://example.org/http://example.org/http://example.org/yikes. So, I left the home_url call bbp_get_user_profile_url, and removed it from all the other places where bbp_get_user_profile_url is used as a base.
Also fixed:
- Replaced bbp_get_user_profile_url() with bbp_get_user_profile_edit_url() in bbp_user_profile_edit_link()
- Fixed bbp_favorites_permalink by using bbp_get_user_favorites_slug() instead of bbp_get_user_favorites_rewrite_id() for pretty permalinks
attachment:2831.03.tests.patch
- Updates all tests for functions that use bbp_get_user_profile_url, in some form, to test for both pretty and unpretty permalinks. Also adds new tests where necessary.
- Fixes avatar tests where get_avatar was expecting a user id and was getting a user object instead
- Adds a private method to more easily set the permalink structure
This will need testing because bbPress's BuddyPress extension filters
bbp_pre_get_user_profile_url