Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: BuddyPress-Links 0.3 FINAL is here at last


foxly
Participant

@foxly

@stwc – Found the defect.

The problem is being caused by two blocks of code inside the BPLinks plugin that do not account for the situation where the BuddyPress administrator disables “friend” capabilities for the site.

When friend capabilities are disabled, calling the friends_check_friendship() function will crash the user thread. We handle this problem in BP Album+ by wrapping all calls to this function in a function_exists(‘friends_check_friendship’) statement, only calling the function if it is enabled.

This is a sneaky, subtle defect that could easily be missed during testing; fortunately, BPLink’s clean, well-documented source code made it easy to isolate and correct the problem.

Here’s a simple patch:

1) In “bp-links-classes.php” at line 650

REPLACE:

if ( $link_owner_user_id && $link_owner_user_id != $bp->loggedin_user->id && friends_check_friendship( $link_owner_user_id, $bp->loggedin_user->id ) ) {

$status_opts[] = self::STATUS_FRIENDS;

}

WITH:

if (function_exists(‘friends_check_friendship’)) {

if ( $link_owner_user_id && $link_owner_user_id != $bp->loggedin_user->id && friends_check_friendship( $link_owner_user_id, $bp->loggedin_user->id ) ) {

$status_opts[] = self::STATUS_FRIENDS;

}

}

2) In “bp-links-core.php” at line 1128

REPLACE:

return friends_check_friendship( $user_id, $link->user_id );

WITH:

if (function_exists(‘friends_check_friendship’))

return friends_check_friendship( $user_id, $link->user_id );

else

return null;

============================================================================

WordPress MU 2.9.2

BuddyPress Version 1.2.3

BuddyPress Links Version 0.3.2

BP Album+ 0.1.8 beta

^F^

Skip to toolbar