Skip to:
Content

BuddyPress.org

Changeset 7784


Ignore:
Timestamp:
02/04/2014 09:55:58 PM (10 years ago)
Author:
imath
Message:

Makes sure the /wp-admin BuddyPress profile stays in the "edit other users" context.

The patch also checks the /wp-admin BuddyPress profile screen is requested before loading the needed javascript.

Fixes #5365

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-admin.php

    r7764 r7784  
    199199        wp_enqueue_style( 'bp-members-css', $css, array(), bp_get_version() );
    200200
    201         $js = $this->js_url . "admin{$min}.js";
    202         $js = apply_filters( 'bp_members_admin_js', $js );
    203         wp_enqueue_script( 'bp-members-js', $js, array( 'jquery' ), bp_get_version(), true );
     201        // Only load javascript for BuddyPress profile
     202        if ( get_current_screen()->id == $this->user_page ) {
     203            $js = $this->js_url . "admin{$min}.js";
     204            $js = apply_filters( 'bp_members_admin_js', $js );
     205            wp_enqueue_script( 'bp-members-js', $js, array( 'jquery' ), bp_get_version(), true );
     206        }
    204207
    205208        // Plugins may want to hook here to load some css/js
     
    285288        if ( ! $user_id = intval( $_GET['user_id'] ) ) {
    286289            wp_die( __( 'No users were found', 'buddypress' ) );
     290        }
     291
     292        // only edit others profile
     293        if ( get_current_user_id() == $user_id ) {
     294            bp_core_redirect( get_edit_user_link( $user_id ) );
    287295        }
    288296
     
    664672     */
    665673    public function row_actions( $actions = '', $user = null ) {
     674        // only edit others profile
     675        if ( get_current_user_id() == $user->ID ) {
     676            return $actions;
     677        }
    666678
    667679        $edit_profile = add_query_arg( array(
Note: See TracChangeset for help on using the changeset viewer.