vBulletin v6.0.4

vB_Api_Follow extends vB_Api
in package

vB_Api_Follow

Table of Contents

Constants

FOLLOWFILTER_ALLTIME  = 'time_all'
FOLLOWFILTER_LASTDAY  = 'time_today'
FOLLOWFILTER_LASTMONTH  = 'time_lastmonth'
FOLLOWFILTER_LASTWEEK  = 'time_lastweek'
FOLLOWFILTER_SORTACTIVITYNEW  = 'sort_activitynew'
FOLLOWFILTER_SORTACTIVITYOLD  = 'sort_activityold'
FOLLOWFILTER_SORTALL  = 'all'
FOLLOWFILTER_SORTLEAST  = 'leastactive'
FOLLOWFILTER_SORTMOST  = 'mostactive'
FOLLOWFILTER_SORTMOSTRECENT  = 'sort_recent'
FOLLOWFILTER_SORTOLDEST  = 'sort_old'
FOLLOWFILTER_SORTPOPULAR  = 'sort_popular'
FOLLOWFILTERTYPE_FOLLOW  = 'filter_follow'
FOLLOWFILTERTYPE_SORT  = 'filter_sort'
FOLLOWFILTERTYPE_TIME  = 'filter_time'
FOLLOWING_NO  = 0
FOLLOWING_PENDING  = 2
FOLLOWING_YES  = 1
FOLLOWTYPE  = 'type'
FOLLOWTYPE_ACTIVITY  = 'follow_all_activity'
FOLLOWTYPE_ALL  = 'follow_all'
FOLLOWTYPE_CHANNELS  = 'follow_channel'
FOLLOWTYPE_CONTENT  = 'follow_contents'
FOLLOWTYPE_USERS  = 'follow_members'

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
add()  : int
This adds a following.- ie. the current user will now follow a user, or specified user $follower will follow a node
addFollower()  : mixed
This adds a user follower
approveFollowing()  : bool
This approves a following request made for the current user.
callNamed()  : The
Call the given api function by name with a named arguments list.
checkApiState()  : mixed
This method checks whether the API method is enabled.
clearCache()  : mixed
Clears all previously loaded API objects.
clearFollowCache()  : void
Clear various internal caches for the follows library
delete()  : int
This deletes a follower. needs userid and followerid, passed or taken from current session
denyFollowing()  : bool
This denies a following request made for the current user.
getApiClassName()  : mixed
getContentFollowers()  : array<string|int, mixed>
Lists the users that are following the given content
getFollowers()  : array<string|int, mixed>
This lists all the current followers, based userid param or current users's userid
getFollowersForCurrentUser()  : array<string|int, mixed>
Gets the followers for the current user
getFollowing()  : array<string|int, mixed>
This lists what a user is following- the parameters, not the content
getFollowingActivities()  : mixed
Get following activity
getFollowingChannels()  : mixed
getFollowingContent()  : array<string|int, mixed>
This lists the content for the user's set parameters
getFollowingContentForTab()  : array<string|int, mixed>
Same as getFollowingContent but implements the 'seemore' button logic.
getFollowingForCurrentUser()  : array<string|int, mixed>
Gets the following for the current user. Uses $this->getFollowing
getFollowingInfo()  : mixed
This gets the params needed for the getFollowing method from the pageInfo array data (query params).
getFollowingUserActivities()  : mixed
Get Following User Activities
getFollowingUsers()  : mixed
getNodeSubscribers()  : array<string|int, mixed>
Return all the subscribers from a given nodeid.
getSubscribersForNotifications()  : array<string|int, mixed>
Return the subscribers who should receive a notification for node $nodeid, excluding $skipUsers
getUnsubscribeText()  : int
Gets the message type to be displayed for the unsubscribe overlay
instance()  : vB_Api
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
instanceInternal()  : vB_Api
Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
isFollowingContent()  : int
This indicates if user is following content.
isFollowingContentList()  : array<string|int, mixed>
This indicates if the current user is following content.
isFollowingUser()  : int
This indicates if user is following user's profile page.
map_vb4_input_to_vb5()  : string
Returns vb5 api method name.
map_vb5_errors_to_vb4()  : mixed
Alters the error array in any way necessary to interface correctly with vb4.
map_vb5_output_to_vb4()  : mixed
Alters the output array in any way necessary to interface correctly with vb4.
removeFollower()  : bool
This removes a follower from user.
removeFollowing()  : The
Removes following from channels or users including all posts related.
unsubscribeItems()  : bool
Unsubscribe items from user.

Constants

FOLLOWFILTER_ALLTIME

public mixed FOLLOWFILTER_ALLTIME = 'time_all'

FOLLOWFILTER_LASTDAY

public mixed FOLLOWFILTER_LASTDAY = 'time_today'

FOLLOWFILTER_LASTMONTH

public mixed FOLLOWFILTER_LASTMONTH = 'time_lastmonth'

FOLLOWFILTER_LASTWEEK

public mixed FOLLOWFILTER_LASTWEEK = 'time_lastweek'

FOLLOWFILTER_SORTACTIVITYNEW

public mixed FOLLOWFILTER_SORTACTIVITYNEW = 'sort_activitynew'

FOLLOWFILTER_SORTACTIVITYOLD

public mixed FOLLOWFILTER_SORTACTIVITYOLD = 'sort_activityold'

FOLLOWFILTER_SORTALL

public mixed FOLLOWFILTER_SORTALL = 'all'

FOLLOWFILTER_SORTLEAST

public mixed FOLLOWFILTER_SORTLEAST = 'leastactive'

FOLLOWFILTER_SORTMOST

public mixed FOLLOWFILTER_SORTMOST = 'mostactive'

FOLLOWFILTER_SORTMOSTRECENT

public mixed FOLLOWFILTER_SORTMOSTRECENT = 'sort_recent'

FOLLOWFILTER_SORTOLDEST

public mixed FOLLOWFILTER_SORTOLDEST = 'sort_old'

FOLLOWFILTER_SORTPOPULAR

public mixed FOLLOWFILTER_SORTPOPULAR = 'sort_popular'

FOLLOWFILTERTYPE_FOLLOW

public mixed FOLLOWFILTERTYPE_FOLLOW = 'filter_follow'

FOLLOWFILTERTYPE_SORT

public mixed FOLLOWFILTERTYPE_SORT = 'filter_sort'

FOLLOWFILTERTYPE_TIME

public mixed FOLLOWFILTERTYPE_TIME = 'filter_time'

FOLLOWING_NO

public mixed FOLLOWING_NO = 0

FOLLOWING_PENDING

public mixed FOLLOWING_PENDING = 2

FOLLOWING_YES

public mixed FOLLOWING_YES = 1

FOLLOWTYPE

public mixed FOLLOWTYPE = 'type'

FOLLOWTYPE_ACTIVITY

public mixed FOLLOWTYPE_ACTIVITY = 'follow_all_activity'

FOLLOWTYPE_ALL

public mixed FOLLOWTYPE_ALL = 'follow_all'

FOLLOWTYPE_CHANNELS

public mixed FOLLOWTYPE_CHANNELS = 'follow_channel'

FOLLOWTYPE_CONTENT

public mixed FOLLOWTYPE_CONTENT = 'follow_contents'

FOLLOWTYPE_USERS

public mixed FOLLOWTYPE_USERS = 'follow_members'

Methods

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

add()

This adds a following.- ie. the current user will now follow a user, or specified user $follower will follow a node

public add(mixed $follow_item[, string $type = vB_Api_Follow::FOLLOWTYPE_USERS ][, mixed $follower = false ][, mixed $auto_subscribe = false ]) : int
@param	int		$follow_item	The follow item id. (could be either a user or node id)
Parameters
$follow_item : mixed
$type : string = vB_Api_Follow::FOLLOWTYPE_USERS

The type of the follow add action. USERS, CHANNELS or CONTENT types. @param int $follower An optional user id which we will be adding the following item. This will be only applied if we are doing a CHANNELS or CONTENT type subscription and the current user has enough channel permissions to grant the subscription. @param boolean $auto_subscribe An optional flag to not verify that a subscription request exists. Used when add() is called from approveChannelRequest's automatic-subscription-post-join handling

$follower : mixed = false
$auto_subscribe : mixed = false
Return values
int

Used to indicate the following status between users. Values meaning: 0 - Not following 1 - Following 2 - Pending

addFollower()

This adds a user follower

public addFollower(mixed $follower) : mixed
Parameters
$follower : mixed
Tags
deprecated

use add

approveFollowing()

This approves a following request made for the current user.

public approveFollowing(mixed $followerid) : bool
Parameters
$followerid : mixed
Return values
bool

callNamed()

Call the given api function by name with a named arguments list.

public callNamed() : The

Used primarily to translate REST requests into API calls.

Return values
The

return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.

checkApiState()

This method checks whether the API method is enabled.

public checkApiState(mixed $method) : mixed

For extensions check make sure $controller property is already set.

Parameters
$method : mixed

clearCache()

Clears all previously loaded API objects.

public static clearCache() : mixed

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

clearFollowCache()

Clear various internal caches for the follows library

public clearFollowCache(mixed $userIds[, bool $contentonly = false ]) : void
Parameters
$userIds : mixed
$contentonly : bool = false

-- if the change only affects content some classes don't need clearing.

delete()

This deletes a follower. needs userid and followerid, passed or taken from current session

public delete([mixed $follow_item = false ][, string $type = vB_Api_Follow::FOLLOWTYPE_USERS ][, int $userid = false ]) : int
@param	int	$follow_item	"optional" (but will throw an exception if not provided) nodeid or userid of the item to stop following.

That is, the item that was being followed by $userid

Parameters
$follow_item : mixed = false
$type : string = vB_Api_Follow::FOLLOWTYPE_USERS

The type of the follow add action. USERS, CHANNELS or CONTENT types.

$userid : int = false

Optional, will use current user if not provided. The userid of the follower/subscriber.

Return values
int

denyFollowing()

This denies a following request made for the current user.

public denyFollowing(mixed $followerid) : bool
Parameters
$followerid : mixed
Tags
deprecated
Return values
bool

getApiClassName()

public static getApiClassName(mixed $controller) : mixed
Parameters
$controller : mixed

getContentFollowers()

Lists the users that are following the given content

public getContentFollowers(mixed $nodeid[, mixed $currentPage = 1 ][, mixed $perpage = 100 ][, mixed $includeFollowInfo = false ]) : array<string|int, mixed>
Parameters
$nodeid : mixed
$currentPage : mixed = 1
$perpage : mixed = 100
$includeFollowInfo : mixed = false
Return values
array<string|int, mixed>

with 2 elements- totalcount (total number of users following the content) and one page of users.

getFollowers()

This lists all the current followers, based userid param or current users's userid

public getFollowers([mixed $userid = false ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
@param int	$userid -- will use current user if not set.
Parameters
$userid : mixed = false
$options : array<string|int, mixed> = []

of options to filters the user followers. Used for pagination at the moment.

Return values
array<string|int, mixed>

of user records

getFollowersForCurrentUser()

Gets the followers for the current user

public getFollowersForCurrentUser([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed> = []

of options to filters the user followers. Used for pagination at the moment.

Return values
array<string|int, mixed>

of user records

getFollowing()

This lists what a user is following- the parameters, not the content

public getFollowing([mixed $userid = false ][, string $type = vB_Api_Follow::FOLLOWTYPE_ALL ][, array<string|int, mixed> $filters = [vB_Api_Follow::FOLLOWFILTERTYPE_SORT => vB_Api_Follow::FOLLOWFILTER_SORTALL] ][, string|array<string|int, mixed> $contenttypeclass = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$userid : mixed = false
$type : string = vB_Api_Follow::FOLLOWTYPE_ALL

= The type of following to get . Use class constants for this, available are: vB_Api_Follow::FOLLOWTYPE_ALL vB_Api_Follow::FOLLOWTYPE_USERS vB_Api_Follow::FOLLOWTYPE_CONTENT vB_Api_Follow::FOLLOWTYPE_CHANNEL

$filters : array<string|int, mixed> = [vB_Api_Follow::FOLLOWFILTERTYPE_SORT => vB_Api_Follow::FOLLOWFILTER_SORTALL]

-- Settings to filter the following. Could be sort or/and type. Key are vB_Api_Follow::FOLLOWFILTERTYPE_SORT. Valid values are: vB_Api_Follow::FOLLOWFILTERTYPE_SORT => vB_Api_Follow::FOLLOWFILTER_SORTMOST vB_Api_Follow::FOLLOWFILTER_SORTLEAST vB_Api_Follow::FOLLOWFILTER_SORTALL

$contenttypeclass : string|array<string|int, mixed> = null

Content types classes to filter the following. It can be a simple string or an array. The classes should contain 'vBForum_' prefix. If not provided then it defaults to all contenttypes except for Channels.

$options : array<string|int, mixed> = []

Array of options to the following. -- page int page to return (default 1) -- perpage int page size (default 100)

Return values
array<string|int, mixed>

with 2 elements- users and nodes.

getFollowingActivities()

Get following activity

public getFollowingActivities([mixed $options = [] ]) : mixed
Parameters
$options : mixed = []

getFollowingChannels()

public getFollowingChannels(mixed $options) : mixed
Parameters
$options : mixed

getFollowingContent()

This lists the content for the user's set parameters

public getFollowingContent([int $userid = false ][, string $type = self::FOLLOWTYPE_ALL ][, mixed $filters = [self::FOLLOWFILTERTYPE_SORT => self::FOLLOWFILTER_SORTALL] ][, mixed $contenttypeclass = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$userid : int = false

User id. If not specified will grab from current user.

$type : string = self::FOLLOWTYPE_ALL

The type of following to get . Use class constants for this, available are: vB_Api_Follow::FOLLOWTYPE_ALL, vB_Api_Follow::FOLLOWTYPE_USERS, vB_Api_Follow::FOLLOWTYPE_CONTENT, vB_Api_Follow::FOLLOWTYPE_CHANNEL

$filters : mixed = [self::FOLLOWFILTERTYPE_SORT => self::FOLLOWFILTER_SORTALL]
$contenttypeclass : mixed = null

Content types classes to filter the following. It can be a simple string or an array. The classes should contain 'vBForum_' prefix.

$options : array<string|int, mixed> = []

Array of options to the following. -- parentid -- pageseemore -- page -- perpage

Return values
array<string|int, mixed>

with 2 elements- users and nodes.

getFollowingContentForTab()

Same as getFollowingContent but implements the 'seemore' button logic.

public getFollowingContentForTab([int $userid = false ][, string $type = self::FOLLOWTYPE_ALL ][, mixed $filters = [self::FOLLOWFILTERTYPE_SORT => self::FOLLOWFILTER_SORTALL] ][, mixed $contenttypeclass = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>

So basically will let the user know if there are more nodes to display using a 'seemore' flag.

This lists the content for the user's set parameters

Parameters
$userid : int = false

User id. If not specified will grab from current user.

$type : string = self::FOLLOWTYPE_ALL

The type of following to get . Use class constants for this, available are: vB_Api_Follow::FOLLOWTYPE_ALL, vB_Api_Follow::FOLLOWTYPE_USERS, vB_Api_Follow::FOLLOWTYPE_CONTENT, vB_Api_Follow::FOLLOWTYPE_CHANNEL

$filters : mixed = [self::FOLLOWFILTERTYPE_SORT => self::FOLLOWFILTER_SORTALL]
$contenttypeclass : mixed = null

Content types classes to filter the following. It can be a simple string or an array. The classes should contain 'vBForum_' prefix.

$options : array<string|int, mixed> = []

Array of options to the following. -- parentid -- pageseemore -- page -- perpage

Return values
array<string|int, mixed>

with 3 elements- users and nodes and paginationinfo.

getFollowingForCurrentUser()

Gets the following for the current user. Uses $this->getFollowing

public getFollowingForCurrentUser(mixed $type[,  $options = [] ]) : array<string|int, mixed>
Parameters
$type : mixed
$options : = []

array Array with options. Used for pagination and sorting at the moment. -- page int page to return (default 1) -- perpage int page size (default 100) -- vB_Api_Follow::FOLLOWFILTERTYPE_SORT string sort type (default vB_Api_Follow::FOLLOWFILTER_SORTALL)

Return values
array<string|int, mixed>

with the following info for the current user.

getFollowingInfo()

This gets the params needed for the getFollowing method from the pageInfo array data (query params).

public getFollowingInfo(mixed $pageInfo) : mixed

Will use class constants

Parameters
$pageInfo : mixed
Return values
mixed

Array with the params needed.

getFollowingUserActivities()

Get Following User Activities

public getFollowingUserActivities([ $options = [] ]) : mixed
Parameters
$options : = []

array (optional) --filter_sort string sort direction (default 'desc') --date_from string date (m/d/Y) (default previous month) --perpage int items per page (default 100) --page int page to fetch (default 1)

getFollowingUsers()

public getFollowingUsers(mixed $options) : mixed
Parameters
$options : mixed

getNodeSubscribers()

Return all the subscribers from a given nodeid.

public getNodeSubscribers(int $nodeid[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$nodeid : int
$options : array<string|int, mixed> = []

-- options to the node subscribers such as page, perpage,

Return values
array<string|int, mixed>

-- subscribers with their information. Such as userid, username, avatar

getSubscribersForNotifications()

Return the subscribers who should receive a notification for node $nodeid, excluding $skipUsers

public getSubscribersForNotifications(int $nodeid[, array<string|int, int> $skipUsers = array() ]) : array<string|int, mixed>

Example code: $nodeNine = 9; $skipUsers = array(2, 3, 4); $apiResult = vB_Api::instance('follow')->getSubscribersForNotifications($nodeNine, $skipUsers); if (!empty($apiResult['subscribers'])) { $subscribersToNine = $apiResult['subscribers']; foreach ($subscribersToNine AS $subscriberData) { echo "User " . $subscriberData['userid'] . " is subscribed to node(s) " . implode(',', $subscriberData['nodeid']) . " with email preference " . $subscriberData['emailupdate'] . "."; } }

Parameters
$nodeid : int

Nodeid to be associated with the subscribers

$skipUsers : array<string|int, int> = array()

Array of userids. Any userid specified will be left out of the returned 'subscribers' array.

Return values
array<string|int, mixed>

API return array. See example below. Contains the data-type & key: array 'subscribers' Unique array containing subscriber data. Each row is keyed by integer and contains an array of data for that with data-types & keys: int 'userid' int 'emailupdate' int[int] 'nodeid' Nodeid(s) of the subscription(s). Ex. if a user has a subscription on channel 3, and $nodeid is a child of that channel, 'nodeid' => array(3 => 3) for that user. If multiple subscriptions are detected, they're all returned. Ex: array( 'subscribers' => array( 1 => array('userid' => 1, 'emailupdate' => 0, 'nodeid' => array(9 => 9)), 5 => array('userid' => 5, 'emailupdate' => 0, 'nodeid' => array(3 => 3)), 6 => array('userid' => 6, 'emailupdate' => 1, 'nodeid' => array(3 => 3, 9 => 9)), ) );

getUnsubscribeText()

Gets the message type to be displayed for the unsubscribe overlay

public getUnsubscribeText(mixed $isFollowingContent, mixed $isFollowingMember, mixed $isFollowingChannel) : int
Parameters
$isFollowingContent : mixed
$isFollowingMember : mixed
$isFollowingChannel : mixed
Return values
int

type number to identify the message to display.

instance()

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

public static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
$controller : string

-- name of the API controller to load

$refresh_cache : bool = false

-- true if we want to force the cache to update with a new api object primarily intended for testing

Return values
vB_Api

instanceInternal()

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

public static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
$controller : string

-- name of the API controller to load

$refresh_cache : bool = false

-- true if we want to force the cache to update with a new api object primarily intended for testing

Return values
vB_Api

isFollowingContent()

This indicates if user is following content.

public isFollowingContent(mixed $contentId) : int
Parameters
$contentId : mixed
Return values
int

Used to indicate the following status between user and content. Values meaning: 0 - Not following 1 - Following

isFollowingContentList()

This indicates if the current user is following content.

public isFollowingContentList(array<string|int, mixed> $nodeids) : array<string|int, mixed>
Parameters
$nodeids : array<string|int, mixed>

-- int array of ids to check

Return values
array<string|int, mixed>

--

  • following -- $nodeids => int array. 0/1/2 for not following/following/pending

isFollowingUser()

This indicates if user is following user's profile page.

public isFollowingUser(mixed $profileUser) : int
Parameters
$profileUser : mixed
Return values
int

Used to indicate the following status between users. Values meaning: 0 - Not following 1 - Following 2 - Pending

map_vb4_input_to_vb5()

Returns vb5 api method name.

public static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string

May alter request array.

Parameters
$method : string

-- vb4 method name

$request : array<string|int, mixed>

-- $_REQUEST array for this api request

Return values
string

map_vb5_errors_to_vb4()

Alters the error array in any way necessary to interface correctly with vb4.

public static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
$method : string

-- vb4 method name

$data : array<string|int, mixed>

-- error array from vb5

map_vb5_output_to_vb4()

Alters the output array in any way necessary to interface correctly with vb4.

public static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
$method : string

-- vb4 method name

$data : array<string|int, mixed>

-- output array from vb5

removeFollower()

This removes a follower from user.

public removeFollower(mixed $follower) : bool
Parameters
$follower : mixed
Tags
deprecated

use delete

Return values
bool

Indicates if the removal succeeded.

removeFollowing()

Removes following from channels or users including all posts related.

public removeFollowing([mixed $followingId = false ][, mixed $userId = false ][, mixed $type = self::FOLLOWTYPE_USERS ]) : The
Parameters
$followingId : mixed = false
$userId : mixed = false
$type : mixed = self::FOLLOWTYPE_USERS
Return values
The

number of items removed.

unsubscribeItems()

Unsubscribe items from user.

public unsubscribeItems(mixed $unsubscribeItems) : bool
Parameters
$unsubscribeItems : mixed
Return values
bool

A flag to indicate if the unsubscribe was successfully done.


        
On this page

Search results