vB_Api_Follow
extends vB_Api
in package
vB_Api_Follow
Tags
Table of Contents
- 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'
- $blocked : mixed
- $controller : string
- API Controller
- $db : vB_Database
- Database object.
- $disabled : bool
- Indicates whether the API was disabled
- $disableFalseReturnOnly : array<string|int, mixed>
- Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others.
- $disableWhiteList : array<string|int, mixed>
- Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others.
- $followers : mixed
- $subscriptions : mixed
- $userFollowers : mixed
- $userFollowing : mixed
- $userListCache : mixed
- $instances : mixed
- $instancesRaw : array<string|int, mixed>
- We want API subclasses to access the instances only through getters
- $vb4_input_mappings : mixed
- $wrappers : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- 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() : mixed
- Clears follow in class cache
- 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() : 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).
- getFollowingParameters() : mixed
- This gets the following parameters- not the content
- getFollowingUserActivities() : mixed
- Get Following User Activities
- getFollowingUsers() : mixed
- getNodeSubscribers() : 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
- getUserList() : mixed
- This gets the followers.
- 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.
- 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.
- __construct() : mixed
- addFollow() : mixed
- addSubscription() : mixed
- checkHasAdminPermission() : none
- Determines if the calling user has the given admin permission, and if not throws an exception
- checkHasPermission() : none
- Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.
- checkIsLoggedIn() : mixed
- Determines if the calling user has the given admin permission, and if not throws an exception
- getApiClass() : mixed
- getApiClassNameInternal() : mixed
- getSubscribedDiscussion() : mixed
- This gets the subscriptions to content nodes
- hasAdminPermission() : bool
- Determines if the calling user has the given admin permission
- inDebugMode() : mixed
- isDisableFalseReturnOnly() : bool
- Checks if method returns false response only when API is disabled.
- isWhiteListed() : bool
- Checks if method is white listed when API is disabled.
- setController() : mixed
- Set controller
- updateUser() : mixed
- validate() : mixed
- validateFollower() : mixed
- validateFollowInformation() : bool
- Validates the follow information passed.
- cms_vb4_to_vb5_method_mapping() : mixed
- default_vb4_to_vb5_method_mapping() : mixed
- getPaginationInfo() : mixed
- hasAdminPermissionInternal() : mixed
- Internal function to power the previous cover functions
- remove_nulls() : mixed
- wrapLoggerIfNeeded() : mixed
- Wrap the api object with the log wrapper class if needed.
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
= ""
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'
Properties
$blocked
protected
mixed
$blocked
= array()
$controller
API Controller
protected
string
$controller
$db
Database object.
protected
vB_Database
$db
$disabled
Indicates whether the API was disabled
protected
bool
$disabled
= alse
$disableFalseReturnOnly
Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others.
protected
array<string|int, mixed>
$disableFalseReturnOnly
= array()
$disableWhiteList
Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others.
protected
array<string|int, mixed>
$disableWhiteList
= array()
$followers
protected
mixed
$followers
= array()
$subscriptions
protected
mixed
$subscriptions
= array()
$userFollowers
protected
mixed
$userFollowers
= array()
$userFollowing
protected
mixed
$userFollowing
= array()
$userListCache
protected
mixed
$userListCache
= array()
$instances
private
static mixed
$instances
$instancesRaw
We want API subclasses to access the instances only through getters
private
static array<string|int, mixed>
$instancesRaw
$vb4_input_mappings
private
static mixed
$vb4_input_mappings
= array(
'blog.post_comment' => array('method' => 'vb4_blog.post_comment'),
'blog.post_postcomment' => array('method' => 'vb4_blog.post_postcomment'),
'blog.post_updateblog' => array('method' => 'vb4_blog.post_updateblog'),
'blog.post_newblog' => array('method' => 'vb4_blog.post_newblog'),
'blog.post_editblog' => array('method' => 'vb4_blog.post_editblog'),
'blog_list' => array('method' => 'vb4_blog.bloglist'),
'api_init' => array('method' => 'api.init'),
'api_cmssectionlist' => array('method' => 'Vb4_Cms.sectionlist'),
'api_cmscategorylist' => array('method' => 'Vb4_Cms.categorylist'),
/*
// These can no longer be mapped directly to vB_Api_User::login/logout
// due to additional processing of devicetoken that may be required
// for mapi calls.
'login_login' => array(
'method' => 'user.login',
'request_mappings' => array(
'vb_login_username' => 'username',
'vb_login_password' => 'password',
'vb_login_md5password' => 'md5password',
'vb_login_md5password_utf' => 'md5passwordutf'
)
),
'login_logout' => array(
'method' => 'user.logout'
),
*/
'get_vbfromfacebook' => array('method' => 'vb4_facebook.getVbfromfacebook'),
)
$wrappers
private
static mixed
$wrappers
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
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 = false ]) : mixed
Parameters
- $follower : mixed = false
Return values
mixed —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
Return values
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.
Return values
mixed —clearFollowCache()
Clears follow in class cache
public
clearFollowCache(mixed $userIds) : mixed
Parameters
- $userIds : mixed
Return values
mixed —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
Return values
bool —getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
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 ][, mixed $options = array() ]) : array<string|int, mixed>
@param int userid- optional
Parameters
- $userid : mixed = false
- $options : mixed = array()
Return values
array<string|int, mixed> —of user records
getFollowersForCurrentUser()
Gets the followers for the current user
public
getFollowersForCurrentUser([mixed $options = array() ]) : mixed
Parameters
- $options : mixed = array()
Return values
mixed —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 = array(vB_Api_Follow::FOLLOWFILTERTYPE_SORT => vB_Api_Follow::FOLLOWFILTER_SORTALL) ][, string|array<string|int, mixed> $contenttypeclass = null ][, array<string|int, mixed> $options = array() ]) : 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> = array(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 and vB_Api_Follow::FOLLOWTYPE. Valid values are: vB_Api_Follow::FOLLOWFILTERTYPE_SORT => vB_Api_Follow::FOLLOWFILTER_SORTMOST vB_Api_Follow::FOLLOWFILTER_SORTLEAST vB_Api_Follow::FOLLOWFILTER_SORTALL vB_Api_Follow::FOLLOWTYPE => vB_Api_Follow::FOLLOWTYPE_USERS, vB_Api_Follow::FOLLOWTYPE_CONTENT vB_Api_Follow::FOLLOWTYPE_CHANNELS vB_Api_Follow::FOLLOWFILTER_TYPEALL
- $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.
- $options : array<string|int, mixed> = array()
-
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 = array() ]) : mixed
Parameters
- $options : mixed = array()
Return values
mixed —getFollowingChannels()
public
getFollowingChannels(mixed $options) : mixed
Parameters
- $options : mixed
Return values
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 = array(self::FOLLOWFILTERTYPE_SORT => self::FOLLOWFILTER_SORTALL) ][, mixed $contenttypeclass = null ][, array<string|int, mixed> $options = array() ]) : 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 = array(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()
-
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() ]) : array<string|int, mixed>
Parameters
- $type : mixed
- $options : = array()
-
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.
getFollowingParameters()
This gets the following parameters- not the content
public
getFollowingParameters([mixed $userid = false ]) : mixed
Parameters
- $userid : mixed = false
Return values
mixed —array of content, user, member. Each is an array of integers. *
getFollowingUserActivities()
Get Following User Activities
public
getFollowingUserActivities([ $options = array() ]) : mixed
Parameters
- $options : = array()
-
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)
Return values
mixed —getFollowingUsers()
public
getFollowingUsers(mixed $options) : mixed
Parameters
- $options : mixed
Return values
mixed —getNodeSubscribers()
Return all the subscribers from a given nodeid.
public
getNodeSubscribers(mixed $nodeid[, mixed $options = array() ]) : mixed
Parameters
- $nodeid : mixed
- $options : mixed = array()
Return values
mixed —Array of the 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.
Tags
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
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.
getUserList()
This gets the followers.
public
getUserList(mixed $userid[, mixed $direction = 'followed' ][, mixed $type = 'follow' ]) : mixed
Parameters
- $userid : mixed
- $direction : mixed = 'followed'
- $type : mixed = 'follow'
Return values
mixed —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
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
Return values
mixed —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
Return values
mixed —removeFollower()
This removes a follower from user.
public
removeFollower([mixed $follower = false ]) : bool
Parameters
- $follower : mixed = false
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.
__construct()
protected
__construct() : mixed
Return values
mixed —addFollow()
protected
addFollow(mixed $userId) : mixed
Parameters
- $userId : mixed
Return values
mixed —addSubscription()
protected
addSubscription(mixed $nodeId[, mixed $subscriber = false ]) : mixed
Parameters
- $nodeId : mixed
- $subscriber : mixed = false
Return values
mixed —checkHasAdminPermission()
Determines if the calling user has the given admin permission, and if not throws an exception
protected
checkHasAdminPermission(string|array<string|int, mixed> $adminPermission) : none
Checks for:
- A valid CP Session
- The passed adminpermission.
Parameters
- $adminPermission : string|array<string|int, mixed>
-
The admin permission to check. If an array then the check passes if the user has any of the permissions given.
Tags
Return values
none —checkHasPermission()
Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.
protected
checkHasPermission(string $group, string $permission) : none
Parameters
- $group : string
-
The permission group where the permission is located
- $permission : string
-
The permission to check
Tags
Return values
none —checkIsLoggedIn()
Determines if the calling user has the given admin permission, and if not throws an exception
protected
checkIsLoggedIn() : mixed
Return values
mixed —getApiClass()
protected
static getApiClass(mixed $controller[, mixed $errorCheck = true ]) : mixed
Parameters
- $controller : mixed
- $errorCheck : mixed = true
Return values
mixed —getApiClassNameInternal()
protected
static getApiClassNameInternal(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —getSubscribedDiscussion()
This gets the subscriptions to content nodes
protected
getSubscribedDiscussion(mixed $userid) : mixed
Parameters
- $userid : mixed
Return values
mixed —hasAdminPermission()
Determines if the calling user has the given admin permission
protected
hasAdminPermission(string|array<string|int, mixed> $adminPermission) : bool
Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.
Parameters
- $adminPermission : string|array<string|int, mixed>
-
The admin permission to check. If an array then the check passes if the user has any of the permissions given.
Return values
bool —true if checks pass, false otherwise
inDebugMode()
protected
inDebugMode() : mixed
Return values
mixed —isDisableFalseReturnOnly()
Checks if method returns false response only when API is disabled.
protected
isDisableFalseReturnOnly(mixed $method) : bool
Parameters
- $method : mixed
Return values
bool —Indicates whether method returns false response only.
isWhiteListed()
Checks if method is white listed when API is disabled.
protected
isWhiteListed(mixed $method) : bool
Parameters
- $method : mixed
Return values
bool —Indicates whether method is or is not a white list.
setController()
Set controller
protected
setController(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —updateUser()
protected
updateUser(mixed $userid) : mixed
Parameters
- $userid : mixed
Return values
mixed —validate()
protected
validate(mixed $followId[, mixed $type = vB_Api_Follow::FOLLOWTYPE_USERS ][, mixed $subscriber = false ]) : mixed
Parameters
- $followId : mixed
- $type : mixed = vB_Api_Follow::FOLLOWTYPE_USERS
- $subscriber : mixed = false
Return values
mixed —validateFollower()
protected
validateFollower(mixed $followerId) : mixed
Parameters
- $followerId : mixed
Return values
mixed —validateFollowInformation()
Validates the follow information passed.
protected
validateFollowInformation(mixed $data) : bool
Needed for add/delete methods. We need to do some perm check and validations on the types, follow item and user.
Parameters
- $data : mixed
Return values
bool —Flag indicating if the information is valid or not.
cms_vb4_to_vb5_method_mapping()
private
static cms_vb4_to_vb5_method_mapping(mixed $method, mixed &$request) : mixed
Parameters
- $method : mixed
- $request : mixed
Return values
mixed —default_vb4_to_vb5_method_mapping()
private
static default_vb4_to_vb5_method_mapping(mixed $method) : mixed
Parameters
- $method : mixed
Return values
mixed —getPaginationInfo()
private
getPaginationInfo(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —hasAdminPermissionInternal()
Internal function to power the previous cover functions
private
hasAdminPermissionInternal(mixed $adminPermission) : mixed
@param string|array $adminPermission The admin permission to check. If an array
then the check passes if the user has any of the permissions given.
Parameters
- $adminPermission : mixed
Return values
mixed —remove_nulls()
private
static remove_nulls(mixed &$data) : mixed
Parameters
- $data : mixed
Return values
mixed —wrapLoggerIfNeeded()
Wrap the api object with the log wrapper class if needed.
private
static wrapLoggerIfNeeded(mixed $controller, mixed $api_object) : mixed
Parameters
- $controller : mixed
- $api_object : mixed