Opened 5 months ago
Last modified 4 months ago
#9235 new enhancement
Compatibility with language subdirectories
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 12.0.0 |
Component: | Members | Keywords: | dev-feedback |
Cc: |
Description
Hi,
since the introduction of the new Rewrite API, i haven't found a good way to make BP Profiles compatible with language subdirectories (e.g "mydomain.com/en/john-doe").
With the legacy parser, it was possible to hook in at certain points and make the whole thing work, but now there doesn't seem to be a way to do this anymore. From what i understand right now, a filter in BP_Members_Component->parse_query() would be required, just before "bp_rewrites_get_member_data()" gets called:
Before:
<?php // Init the current member and member type. $member = false; $member_type = false; $member_data = bp_rewrites_get_member_data();
After:
<?php $request = apply_filters('bp_members_parse_query_request', $GLOBALS['wp']->request); // Init the current member and member type. $member = false; $member_type = false; $member_data = bp_rewrites_get_member_data($request);
This would allow for the requested URI to be filtered, right before it get's passed to "bp_rewrites_get_member_data" and manipulate it such that this function knows where to look for the username in the string.
Change History (4)
#2
in reply to:
↑ 1
@
5 months ago
- Keywords reporter-feedback removed
Replying to imath:
Hi,
Thanks for your feedback, there’s a way to add a root prefix to URLs, but I don’t think it would be a viable solution as I guess the « en » thing can be « fr » or « es » and rewrite rules are saved to the database.
How do you manage what you call language subdirectories with regular WordPress posts or pages ?
I just use the Polylang plugin, you can set it up to use your site with language subdirectories.
Hi,
Thanks for your feedback, there’s a way to add a root prefix to URLs, but I don’t think it would be a viable solution as I guess the « en » thing can be « fr » or « es » and rewrite rules are saved to the database.
How do you manage what you call language subdirectories with regular WordPress posts or pages ?