The URL you add to the permalink field is not the search criteria. The URL being accessed is. If it were the other way around dynamic URL’s in the permalink field would be an option.
Is this just an extrapolation of your current logic or that would actually be a possible, codable logic?
If someone else has any ideas I’m open to suggestions.
Suggestion #1 : Use Buddypress tables?
I’m far from being an expert developer but wouldn’t it be possible to grab the username somewhere? Here’s the flow I’ve “imagined” :
1- Page is accessed, PO looks for a rule matching accessed URL
2- No rule matching for accessed URL, but…
3- 3 “dynamic” rules exist
4- 1 “dynamic” rule match accessed URL, but one slug
Example :
Accessed URL : https://www.mywebsite.com/members/johndoe/activity
Dynamic rules :
https://www.mywebsite.com/members/{USRN}/activity
https://www.mywebsite.com/members/{USRN}/forums
https://www.mywebsite.com/members/{USRN}/cart
Matched dynamic rule :
https://www.mywebsite.com/members/{USRN}/activity
5- PO looks for “johndoe” in Buddypress
6- If Buddypress table contain entry for username “johndoe”, PO consider the dynamic rule as an acceptable match for the accessed URL.
7- Possible step to make other queries faster by storing the username index somewhere?
Suggestion #2 : Use specific permalinks structure?
Buddypress allows us to have root profile (yourwebsite.com/johndoe), so this solution wouldn’t work if someone enabled this feature.
We would find a field in PO settings to give information about our buddypress profiles slug (i.e : members). This slug will always be find right after the website (i.e : yourwebsite.com/members/).
The username is always right after the profiles slug (i.e : yourwebsite.com/members/johndoe).
The goal would be to disregard the username (second slug after the website root) for permalinks that match the “members” slug criteria.
We would find a checkbox on the filter rule page “This is a member page”. If checked, the URL could be “yourwebsite.com/members/johndoe/cart” and still match URLs like “yourwebsite.com/members/michaelj/cart”
I had another idea but just lost it explaining these first two… Will get back at you if I remember.
Cheers,
Bastien