Skip to:
Content

BuddyPress.org

Changeset 5542


Ignore:
Timestamp:
12/13/2011 06:19:36 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Back-port bp_members_edit_profile_url() from trunk to filter the Edit Profile URL. Fixes $3850 (1.5 branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5/bp-members/bp-members-filters.php

    r4961 r5542  
    4646add_action( 'bp_loaded', 'bp_members_signup_sanitization' );
    4747
     48/**
     49 * Filter the user profile URL to point to BuddyPress profile edit
     50 *
     51 * @since BuddyPress 1.5.2
     52 *
     53 * @global BuddyPress $bp
     54 * @param string $url
     55 * @param int $user_id
     56 * @param string $scheme
     57 * @return string
     58 */
     59function bp_members_edit_profile_url( $url, $user_id, $scheme = 'admin' ) {
     60    global $bp;
     61
     62    // Default to $url
     63    $profile_link = $url;
     64
     65    // If xprofile is active, use profile domain link
     66    if ( bp_is_active( 'xprofile' ) ) {
     67        $user_domain  = bp_core_get_user_domain( $user_id );
     68        $profile_link = trailingslashit( $user_domain . $bp->profile->slug . '/edit' );
     69    }
     70   
     71    return apply_filters( 'bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme );
     72}
     73add_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 );
     74
    4875?>
Note: See TracChangeset for help on using the changeset viewer.