Documentation

Subscriptions
in package
implements ActionInterface uses ActionTrait, BackwardCompatibility

Contains all the administration functions for paid subscriptions.

(and some more than that :P)

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.

Properties

$all  : array<string|int, mixed>
$subaction  : string
$subactions  : array<string|int, mixed>
$obj  : static

Methods

add()  : void
Add or extend a subscription of a user.
call()  : void
Convenience method to load() and execute() an instance of this class.
canBeLogged()  : bool
Determines whether this action can be logged in the online log.
canShowDebuggingInfo()  : bool
Determines whether debugging info should be shown.
canShowInMaintenanceMode()  : bool
Determines whether this action allows access in maintenance mode.
execute()  : void
Dispatcher to whichever sub-action method is necessary.
getConfigVars()  : array<string|int, mixed>
Gets the configuration variables for this admin area.
getOutputType()  : OutputTypeInterface
Gets the output type for this action.
getSubs()  : array<string|int, mixed>
Fetches data about all the configured subscriptions.
isAgreementAction()  : bool
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
isRestrictedGuestAccessAllowed()  : bool
Determines whether this action allows access if guest access is restricted.
isSimpleAction()  : bool
Determines whether this is a simple action.
list_getSubscribedUserCount()  : int
Returns how many people are subscribed to a paid subscription.
list_getSubscribedUsers()  : array<string|int, mixed>
Return the subscribed users list, for the given parameters.
load()  : static
Static wrapper for constructor.
loadPaymentGateways()  : array<string|int, mixed>
Load all the payment gateways.
modify()  : void
Adding, editing and deleting subscriptions.
modifyUser()  : void
Edit or add a user subscription.
reapply()  : void
Reapplies all subscription rules for each of the users.
remove()  : void
Removes a subscription from a user, as in removes the groups.
settings()  : void
Set any setting related to paid subscriptions, i.e.
subActionProvider()  : null|array<string|int, mixed>
Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
view()  : void
View a list of all the current subscriptions Requires the admin_forum permission.
viewUsers()  : void
View all the users subscribed to a particular subscription.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().

Properties

$all

public static array<string|int, mixed> $all = []

Data about all the subscriptions the admin has created.

$subaction

public string $subaction = 'view'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['view' => ['view', 'admin_forum'], 'viewsub' => ['viewUsers', 'admin_forum'], 'modify' => ['modify', 'admin_forum'], 'modifyuser' => ['modifyUser', 'admin_forum'], 'settings' => ['settings', 'admin_forum']]

Available sub-actions.

Format: 'sa' => array('method', 'required_permission')

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

Methods

add()

Add or extend a subscription of a user.

public static add(int $id_subscribe, int $id_member[, int|string $renewal = 0 ][, int $forceStartTime = 0 ][, int $forceEndTime = 0 ]) : void
Parameters
$id_subscribe : int

The subscription ID

$id_member : int

The ID of the member

$renewal : int|string = 0

0 if we're forcing start/end time, otherwise a string indicating how long to renew the subscription for ('D', 'W', 'M' or 'Y')

$forceStartTime : int = 0

If set, forces the subscription to start at the specified time

$forceEndTime : int = 0

If set, forces the subscription to end at the specified time

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

canBeLogged()

Determines whether this action can be logged in the online log.

public canBeLogged() : bool
Return values
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

getConfigVars()

Gets the configuration variables for this admin area.

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

$config_vars for the news area.

getSubs()

Fetches data about all the configured subscriptions.

public static getSubs() : array<string|int, mixed>

Loads the data into self::$all. Sets Utils::$context['subscriptions'] as a reference to self::$all. Also returns a copy of self::$all.

Return values
array<string|int, mixed>

A copy of self::$all.

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

Determines whether this action allows access if guest access is restricted.

public isRestrictedGuestAccessAllowed() : bool
Return values
bool

True if access is allowed, false otherwise.

isSimpleAction()

Determines whether this is a simple action.

public isSimpleAction() : bool
Return values
bool

list_getSubscribedUserCount()

Returns how many people are subscribed to a paid subscription.

public static list_getSubscribedUserCount(int $id_sub, string $search_string[, array<string|int, mixed> $search_vars = [] ]) : int
Parameters
$id_sub : int

The ID of the subscription

$search_string : string

A search string

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

An array of variables for the search string

Tags
todo

refactor away

Return values
int

The number of subscribed users matching the given parameters

list_getSubscribedUsers()

Return the subscribed users list, for the given parameters.

public static list_getSubscribedUsers(int $start, int $items_per_page, string $sort, int $id_sub, string $search_string[, array<string|int, mixed> $search_vars = [] ]) : array<string|int, mixed>
Parameters
$start : int

The item to start with (for pagination purposes)

$items_per_page : int

How many items to show on each page

$sort : string

A string indicating how to sort the results

$id_sub : int

The ID of the subscription

$search_string : string

A search string

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

The variables for the search string

Tags
todo

refactor outta here

Return values
array<string|int, mixed>

An array of information about the subscribed users matching the given parameters

load()

Static wrapper for constructor.

public static load() : static
Return values
static

An instance of this class.

loadPaymentGateways()

Load all the payment gateways.

public static loadPaymentGateways() : array<string|int, mixed>
  • Looks for 3.x-style payment gateways in Sources/Subscriptions.
  • Looks for 2.x-style payment gateways in Sources.
Return values
array<string|int, mixed>

An array of information about available payment gateways

modify()

Adding, editing and deleting subscriptions.

public modify() : void

Accessed from ?action=admin;area=paidsubscribe;sa=modify.

modifyUser()

Edit or add a user subscription.

public modifyUser() : void

Accessed from ?action=admin;area=paidsubscribe;sa=modifyuser.

reapply()

Reapplies all subscription rules for each of the users.

public static reapply(array<string|int, mixed> $users) : void
Parameters
$users : array<string|int, mixed>

An array of user IDs

Tags
todo

This appears to be unused. Remove it?

remove()

Removes a subscription from a user, as in removes the groups.

public static remove(int $id_subscribe, int $id_member[, bool $delete = false ]) : void
Parameters
$id_subscribe : int

The ID of the subscription

$id_member : int

The ID of the member

$delete : bool = false

Whether to delete the subscription or just disable it

settings()

Set any setting related to paid subscriptions, i.e.

public settings() : void

modify which payment methods are to be used. It requires the moderate_forum permission Accessed from ?action=admin;area=paidsubscribe;sa=settings.

subActionProvider()

Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods

public static subActionProvider([null|string $sa = null ][, bool $return_config = false ][, string|null $activity = null ]) : null|array<string|int, mixed>
Parameters
$sa : null|string = null
$return_config : bool = false
$activity : string|null = null
Return values
null|array<string|int, mixed>

view()

View a list of all the current subscriptions Requires the admin_forum permission.

public view() : void

Accessed from ?action=admin;area=paidsubscribe;sa=view.

viewUsers()

View all the users subscribed to a particular subscription.

public viewUsers() : void

Requires the admin_forum permission. Accessed from ?action=admin;area=paidsubscribe;sa=viewsub.

Subscription ID is required, in the form of $_GET['sid'].

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

        
On this page

Search results