Skip to:
Content

BuddyPress.org

Ticket #5365: 5365.diff

File 5365.diff, 1.7 KB (added by imath, 11 years ago)
  • bp-members/bp-members-admin.php

     
    198198                $css = apply_filters( 'bp_members_admin_css', $css );
    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
    206209                do_action( 'bp_members_admin_enqueue_scripts', get_current_screen()->id, $this->screen_id );
     
    286289                        wp_die( __( 'No users were found', 'buddypress' ) );
    287290                }
    288291
     292                // only edit others profile
     293                if ( get_current_user_id() == $user_id ) {
     294                        bp_core_redirect( get_edit_user_link( $user_id ) );
     295                }
     296
    289297                // Build redirection URL
    290298                $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham', 'delete_avatar' ), $_SERVER['REQUEST_URI'] );
    291299                $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
     
    663671         * @return array Merged actions.
    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(
    668680                        'user_id'         => $user->ID,