Participation
Table of Contents
Classes
- CB_Participation_Component
- CB Participation Component
- CB_Participation_Participation
- CB Participation Participation
Functions
- cb_ajax_update_participation() : mixed
- Handles HTTP PATCH requests to update participation entries.
- cb_ajax_new_participation() : mixed
- CB Ajax New Participation
- cb_ajax_get_participation() : mixed
- CB AJAX Get Participation
- cb_participation_add_filler_data() : mixed
- Adds 5 participation entries for testing purposes.
- 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_update_notifications() : mixed
- CB Participation Update Notifications
- cb_setup_participation() : mixed
- CB Setup Participation
- cb_participation_event_type_filter() : mixed
- CB Participation Event Type Filter
- cb_participation_nav() : mixed
- Outputs markup for the participation nav.
- cb_participation_format_nav_data() : array<string|int, mixed>
- Formats the nav data for the participation component.
- cb_participation_get_nav() : string
- Returns the nav for the participation filtering system.
- cb_participation_admin_nav() : mixed
- Outputs the participation admin nav.
- cb_participation_admin_get_nav() : string
- Returns the nav for the participation admin filtering system.
Functions
cb_ajax_update_participation()
Handles HTTP PATCH requests to update participation entries.
cb_ajax_update_participation() : mixed
Processes standard and bulk participation updates from an HTTP PATCH request.
Tags
cb_ajax_new_participation()
CB Ajax New Participation
cb_ajax_new_participation() : mixed
We'll use this to process the new participation entries sent via ajax.
Tags
cb_ajax_get_participation()
CB AJAX Get Participation
cb_ajax_get_participation() : mixed
Our REST API handler for the endpoint at "/wp-json/cb-ajax/v1/participation/get"
Tags
cb_participation_add_filler_data()
Adds 5 participation entries for testing purposes.
cb_participation_add_filler_data() : mixed
Tags
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_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
Tags
cb_setup_participation()
CB Setup Participation
cb_setup_participation() : mixed
Sets up our participation component, so we have easy access to component globals.
Tags
cb_participation_event_type_filter()
CB Participation Event Type Filter
cb_participation_event_type_filter([bool $is_admin = false ]) : mixed
Outputs markup for a participation event type select input.
Parameters
- $is_admin : bool = false
-
Whether it's for an filter selection. There's probably a better way to do this, but we need a band-aid for now, because we're down to the wire on this update. :D
Tags
cb_participation_nav()
Outputs markup for the participation nav.
cb_participation_nav() : mixed
Tags
cb_participation_format_nav_data()
Formats the nav data for the participation component.
cb_participation_format_nav_data([mixed $component = '' ][, array<string|int, mixed> $items = array() ]) : array<string|int, mixed>
We need a pretty complicated set of arguments for cb_templates_get_nav() and cb_templates_get_nav_items() and this helps us achieve that in a structured way.
Parameters
- $component : mixed = ''
- $items : array<string|int, mixed> = array()
-
A collection of key => value pairs
Tags
Return values
array<string|int, mixed> —The list of formatted nav data.
cb_participation_get_nav()
Returns the nav for the participation filtering system.
cb_participation_get_nav() : string
Tags
Return values
string —The nav markup.
cb_participation_admin_nav()
Outputs the participation admin nav.
cb_participation_admin_nav() : mixed
Tags
cb_participation_admin_get_nav()
Returns the nav for the participation admin filtering system.
cb_participation_admin_get_nav() : string
Tags
Return values
string —The nav markup.