Documentation

FriendsManager

User Extended by Shawn Clake Class FriendsManager User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

Table of Contents

UE_BLOCKED  = 1048576
UE_DECLINED  = 16
UE_DELETED  = 2097152
UE_FOLLOWING  = 2
UE_FRIEND_REQUESTED  = 1
UE_FRIENDS  = 8
UE_RELATION_RECEIVER  = 'user_that_accepted_request'
UE_RELATION_SENDER  = 'user_that_sent_request'
UE_SUBSCRIBED  = 4
$UE_RELATION_STATES  : mixed
These states are for 2.2.00 and don't function as part of the current release.
acceptRequest()  : mixed
Accepts a friend request from a user One user is UserID1 Other user is UserID2. Logged in user by default
blockFriend()  : mixed
Sets the relation between two users to blocked. Creates a new one if one already exists
bondStateCreator()  : bool|number
Creates a bond state value for plugins. This is an automated process so they don't have calculate it themselves
declineRequest()  : mixed
Declines a friend request from a user
deleteFriend()  : mixed
Soft deletes a friend. To read a friend it will create a new record in the DB This is useful to keep track of when, and how many times users deleted each other
getAllFriends()  : FriendsManager|Collection
Returns all friends for the logged in user
isFriend()  : bool
Returns whether or not a user is our friend Leave the second parameter blank to user the logged in user
isRequested()  : bool
Returns whether or not the two users have a friend request between them.
listFriends()  : Collection|static
Returns the list of friends for the logged in user with a limit
listReceivedFriendRequests()  : Collection
Returns a list of friend requests received.
listRequests()  : Collection|static
Returns a list of both sent and received friend requests for the logged in user
sendFriendRequest()  : mixed
Sends a friend request

Constants

UE_RELATION_RECEIVER

public mixed UE_RELATION_RECEIVER = 'user_that_accepted_request'

UE_RELATION_SENDER

public mixed UE_RELATION_SENDER = 'user_that_sent_request'

Properties

$UE_RELATION_STATES

These states are for 2.2.00 and don't function as part of the current release.

public static mixed $UE_RELATION_STATES = ['1' => 'UE_FRIEND_REQUESTED', '2' => 'UE_FOLLOWING', '4' => 'UE_SUBSCRIBED', '8' => 'UE_FRIENDS', '16' => 'UE_DECLINED', '1048576' => 'UE_BLOCKED', '2097152' => 'UE_DELETED']

Methods

acceptRequest()

Accepts a friend request from a user One user is UserID1 Other user is UserID2. Logged in user by default

public static acceptRequest( $userId1[, null $userId2 = null ]) : mixed
Parameters
$userId1 :
$userId2 : null = null
Return values
mixed

blockFriend()

Sets the relation between two users to blocked. Creates a new one if one already exists

public static blockFriend( $friendUserId) : mixed
Parameters
$friendUserId :
Return values
mixed

bondStateCreator()

Creates a bond state value for plugins. This is an automated process so they don't have calculate it themselves

public static bondStateCreator( $bondNumber) : bool|number
Parameters
$bondNumber :
Return values
bool|number

declineRequest()

Declines a friend request from a user

public static declineRequest( $userId1[, null $userId2 = null ]) : mixed
Parameters
$userId1 :
$userId2 : null = null
Return values
mixed

deleteFriend()

Soft deletes a friend. To read a friend it will create a new record in the DB This is useful to keep track of when, and how many times users deleted each other

public static deleteFriend( $friendUserId) : mixed
Parameters
$friendUserId :
Return values
mixed

isFriend()

Returns whether or not a user is our friend Leave the second parameter blank to user the logged in user

public static isFriend( $userID1[, null $userID2 = null ]) : bool
Parameters
$userID1 :
$userID2 : null = null
Return values
bool

isRequested()

Returns whether or not the two users have a friend request between them.

public static isRequested( $userID1[, null $userID2 = null ]) : bool

Leave the second parameter blank to user the logged in user

Parameters
$userID1 :
$userID2 : null = null
Return values
bool

listFriends()

Returns the list of friends for the logged in user with a limit

public static listFriends(int $limit[, null $userId = null ]) : Collection|static
Parameters
$limit : int
$userId : null = null
Return values
Collection|static

listReceivedFriendRequests()

Returns a list of friend requests received.

public static listReceivedFriendRequests([int $limit = 5 ]) : Collection
Parameters
$limit : int = 5
Return values
Collection

listRequests()

Returns a list of both sent and received friend requests for the logged in user

public static listRequests([int $limit = 100 ]) : Collection|static
Parameters
$limit : int = 100
Return values
Collection|static

sendFriendRequest()

Sends a friend request

public static sendFriendRequest( $friendUserId) : mixed
Parameters
$friendUserId :
Return values
mixed

Search results