Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/12/2014 01:54:46 AM (10 years ago)
Author:
boonebgorges
Message:

block_self should not block all buttons when inside a members loop on one's own profile

This changeset reconfigures the block_self logic in BP_Button so that the
bp_is_my_profile() check is skipped when inside of a members loop. This allows
block_self logic to operate properly when inside of a members loop that happens
to appear on the logged-in user's profile page.

Also adds unit tests for the block_self param.

Fixes #5734

Props r-a-y for the initial patch.

File:
1 edited

Legend:

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

    r8558 r8607  
    18921892            return false;
    18931893
    1894         // No button if viewing your own profile
    1895         if ( true == $this->block_self && bp_is_my_profile() )
    1896             return false;
    1897 
    1898         // No button if you are the current user in a loop
    1899         if ( true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() )
    1900             return false;
     1894        // block_self
     1895        if ( true == $this->block_self ) {
     1896            // No button if you are the current user in a members loop
     1897            // This condition takes precedence, because members loops
     1898            // can be found on user profiles
     1899            if ( bp_get_member_user_id() ) {
     1900                if ( is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id() ) {
     1901                    return false;
     1902                }
     1903
     1904            // No button if viewing your own profile (and not in
     1905            // a members loop)
     1906            } else if ( bp_is_my_profile() ) {
     1907                return false;
     1908            }
     1909        }
    19011910
    19021911        // Wrapper properties
Note: See TracChangeset for help on using the changeset viewer.