[buddypress-trac] [BuddyPress Trac] #6694: filter for $after_member_slug in bp-core-catchuri.php
buddypress-trac
noreply at wordpress.org
Fri Oct 30 15:52:48 UTC 2015
#6694: filter for $after_member_slug in bp-core-catchuri.php
------------------------------+-----------------------------
Reporter: kmb@… | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Component - Core | Version: 2.3.3
Severity: normal | Keywords:
------------------------------+-----------------------------
Hi,
one can modify the user_domain with the filter "bp_core_get_user_domain".
But there is no way to map this back, so I need a patch like this:
{{{
+++ wp-content/plugins/bp-custom.php
@@ -265,6 +265,8 @@ function bp_core_set_uri_globals() {
// Are we viewing a specific user?
if ( $after_member_slug ) {
+ $after_member_slug = apply_filters(
'bp_core_catchuri_after_member_slug', $after_member_slug);
+
// Switch the displayed_user based on
compatibility mode
if ( bp_is_username_compatibility_mode() )
{
$bp->displayed_user->id = (int)
bp_core_get_userid( urldecode( $after_member_slug ) );
}}}
The reason behind this:
I need to create "anonymous" URLs for selected members. The next code-
snipped is an example on how to do this.
But be aware, this is just a test to create URLs based on the member-id -
not a real anonymizer.
{{{
function TEST_anonymize_url($domain, $user_id, $user_nicename,
$user_login) {
$after_domain = bp_core_enable_root_profiles() ? $user_id :
bp_get_members_root_slug() . '/' . $user_id;
$domain = trailingslashit( bp_get_root_domain() . '/' .
$after_domain );
return $domain;
}
add_action('bp_core_get_user_domain', 'TEST_anonymize_url', 20, 4);
function TEST_de_anonymize_url($after_member_slug) {
return bp_members_get_user_nicename($after_member_slug);
}
add_action('bp_core_catchuri_after_member_slug', 'TEST_de_anonymize_url',
20);
}}}
Would be nice, if you could include this in 2.5.
thanks
Klaus
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6694>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list