Skip to:
Content

BuddyPress.org

Opened 5 months ago

Last modified 4 months ago

#9235 new enhancement

Compatibility with language subdirectories

Reported by: liongrass's profile liongrass 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)

#1 follow-up: @imath
5 months ago

  • Keywords reporter-feedback added

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 ?

#2 in reply to: ↑ 1 @liongrass
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.

#3 @liongrass
4 months ago

May i submit a pull request to add the aforementioned filter? If you have a better name for the filter btw let me know!

#4 @liongrass
4 months ago

  • Keywords dev-feedback added
Note: See TracTickets for help on using tickets.