action_functions.php
Table of Contents
Functions
- get_user_actions() : mixed
- Retrieve a list of user actions for the My Actions area.
- get_editable_resource_sql() : mixed
- Return an SQL statement to find all editable resources in $actions_notify_states.
- get_user_actions_recent() : array<string|int, mixed>
- Get recent user actions, optionally for all users. For use by action notifications cron job.
- actions_filter_by_user() : array<string|int, mixed>
- Filter actions in the provided array to return only those applicable to the given user
Functions
get_user_actions()
Retrieve a list of user actions for the My Actions area.
get_user_actions([bool $countonly = false ][, string $type = "" ][, string $order_by = "date" ][, string $sort = "DESC" ]) : mixed
Parameters
- $countonly : bool = false
-
Return the count of actions instead of the actions themselves
- $type : string = ""
-
Filter the actions based on action type The available inputs are: resourcereview resourcerequest userrequest
- $order_by : string = "date"
- $sort : string = "DESC"
Return values
mixed —Count or array of actions
get_editable_resource_sql()
Return an SQL statement to find all editable resources in $actions_notify_states.
get_editable_resource_sql() : mixed
get_user_actions_recent()
Get recent user actions, optionally for all users. For use by action notifications cron job.
get_user_actions_recent(int $minutes, bool $allusers) : array<string|int, mixed>
Parameters
- $minutes : int
-
Return actions that were created in the last $minutes minutes
- $allusers : bool
-
Return actions for all users? If false, or if the current user does not have the 'a' permission and the current script is not running from CLI then only the currently logged on user's actions will be returned
Return values
array<string|int, mixed> —An array with the user id as the index and the following arrays of sub elements. Included columns are as per get_user_actions()
- resourcerequest - array of resource requests
- userrequest - array of user requests
- resourcereview - array of resources to reviewdescription)
actions_filter_by_user()
Filter actions in the provided array to return only those applicable to the given user
actions_filter_by_user(int $actionuser, array<string|int, mixed> $actions) : array<string|int, mixed>
Parameters
- $actionuser : int
-
User ref to get actions for
- $actions : array<string|int, mixed>
-
Array of actions as returned by get_user_actions_recent()
Return values
array<string|int, mixed> —Subset of actions for the given user as would be provided by get_user_actions()