Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2014 05:37:38 PM (11 years ago)
Author:
boonebgorges
Message:

Return false friends_add_friend() when the initiator is the same as the friend

It's good to love yourself, but there's no real reason to allow
self-friendships in BuddyPress.

See #5319

Props megainfo, r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-functions.php

    r7673 r8172  
    3030 */
    3131function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) {
     32
     33    // You cannot be friends with yourself!
     34    if ( $initiator_userid == $friend_userid ) {
     35        return false;
     36    }
    3237
    3338    // Check if already friends, and bail if so
Note: See TracChangeset for help on using the changeset viewer.