cb-participation-functions.php
Table of Contents
Functions
- cb_participation_new_participation() : mixed
- CB Participation Create Participation
- cb_participation_new_transaction() : int|string
- Confetti Bits Participation New Transaction
- cb_participation_get_amount() : int
- CB Participation Get Amount
- cb_participation_get_log_entry() : string
- CB Participation Get Log Entry
- cb_participation_get_transaction() : array<string|int, mixed>|bool
- CB Get Transaction
- cb_participation_new_notifications() : mixed
- cb_participation_update_notifications() : mixed
- CB Participation Update Notifications
Functions
cb_participation_new_participation()
CB Participation Create Participation
cb_participation_new_participation(array<string|int, mixed> $args) : mixed
Creates a new participation object and saves it to the database.
Parameters
- $args : array<string|int, mixed>
-
Associative array of arguments for saving. All arguments are optional except for media_filepath. { @type int $item_id For BuddyBoss Platform's Notifications API. Registers the primary data for the notification. We'll use the applicant_id for this. ---------- @TODO: We need to make sure this is correct.
@type int $secondary_item_id For BuddyBoss Platform's Notifications API. Register's the receiver's profile avatar in the notification. We'll use the admin_id for this. ---------- @TODO: We need to make sure this is correct. @type int $applicant_id The user_id associated with the participation entry. @type int $admin_id The user_id of the last admin that modified the entry. @type string $date_created A mysql datetime entry for when the participation was registered. @type string $date_modified A mysql datetime entry for when the participation was registered. @type string $event_type The type of event being registered. We typically use these event_types: { "dress_up", "food", "holiday", "activity", "awareness", "meeting", "workshop", "contest", "other" } @type string $component_name For BuddyBoss Platform's Notifications API. Helps the API know which notification group to use. @type string $component_action For BuddyBoss Platform's Notifications API. Helps the API know which notification format to use. @type string $status The status of the participation entry. Common statuses include "new", "approved", "denied", or "pending".
}
Tags
cb_participation_new_transaction()
Confetti Bits Participation New Transaction
cb_participation_new_transaction([array<string|int, mixed> $args = [] ]) : int|string
Add or subtract Confetti Bits based on participation approval status. We're probably going to deprecate all over this bad boy as we continue to transition everything to async.
Parameters
- $args : array<string|int, mixed> = []
-
An array of parameters for us to work with. { @type int $transaction_id A transaction ID for us to check for. @type int $participation_id A participation ID for us to check for. @type int $admin_id An admin ID for us to check for. @type string $status The status of the participation entry. @type string $modified The date of the last modification for the participation entry. @type int $amount An amount to check for in the transaction. }
Tags
Return values
int|string —Transaction ID on success, error on failure.
cb_participation_get_amount()
CB Participation Get Amount
cb_participation_get_amount([int $participation_id = 0 ][, string $status = '' ][, string $override = 0 ]) : int
Attempt to extract a predetermined value from valid event types.
Parameters
- $participation_id : int = 0
-
The participation entry to check against
- $status : string = ''
-
The status that we are updating to.
- $override : string = 0
-
An amount override, typically submitted via form submission or API request.
Tags
Return values
int —$amount The amount we extracted.
cb_participation_get_log_entry()
CB Participation Get Log Entry
cb_participation_get_log_entry([int $participation_id = 0 ][, string $admin_log_entry = '' ]) : string
Attempt to extract a predetermined log entry from valid event types.
Parameters
- $participation_id : int = 0
-
The ID for the participation entry we're checking.
- $admin_log_entry : string = ''
-
An optional admin log entry override.
Tags
Return values
string —$log_entry The log entry we extracted.
cb_participation_get_transaction()
CB Get Transaction
cb_participation_get_transaction([int $transaction_id = 0 ]) : array<string|int, mixed>|bool
We need to check if a transaction exists for a given participation entry, and perform operations based on that result.
Parameters
- $transaction_id : int = 0
-
The ID for the transaction we're looking for.
Tags
Return values
array<string|int, mixed>|bool —Transaction if the object exists, false if not or we get an error.
cb_participation_new_notifications()
cb_participation_new_notifications([mixed $data = array() ]) : mixed
Parameters
- $data : mixed = array()
cb_participation_update_notifications()
CB Participation Update Notifications
cb_participation_update_notifications([mixed $participation_id = 0 ]) : mixed
This will notify a user after a participation entry has been updated to a new status.
Parameters
- $participation_id : mixed = 0