Skip to:
Content

BuddyPress.org

Changeset 6924


Ignore:
Timestamp:
04/19/2013 06:48:03 PM (11 years ago)
Author:
boonebgorges
Message:

In BP_Button, make 'block_self' work in member loops

block_self is designed to make buttons invisible when a user is looking at his
own page. This changeset makes it so that block_self also hides block_self
buttons during a bp_has_members() loop on the iteration where the current user
id is the currently iterated users.

Note that BP does not currently put any such buttons in the members directory.
This patch is for plugins/themes that add their own custom buttons.

Fixes #4709

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r6654 r6924  
    15731573            return false;
    15741574
     1575        // No button if you are the current user in a loop
     1576        if ( true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() )
     1577            return false;
     1578
    15751579        // Wrapper properties
    15761580        if ( false !== $this->wrapper ) {
  • trunk/bp-members/bp-members-template.php

    r6815 r6924  
    384384    function bp_get_member_user_id() {
    385385        global $members_template;
    386 
    387         return apply_filters( 'bp_get_member_user_id', $members_template->member->id );
     386        $member_id = isset( $members_template->member->id ) ? (int) $members_template->member->id : false;
     387        return apply_filters( 'bp_get_member_user_id', $member_id );
    388388    }
    389389
Note: See TracChangeset for help on using the changeset viewer.