API Documentation
Table of Contents
Classes
- CB_Ajax_Component
- A component that helps organize our AJAX endpoints.
- TeamCTG_User_Caps
- CB_Component
- CB Component
- CB_Core_Date_Query
- CB_Core_Role_Manager
- CB Core Roles Component
- CB_Core_Role
- CB Core Roles Component
- CB_Core
- CB Component
- Confetti_Bits_Core_App_Menus
- CB_Events_Component
- A component that allows certain users to create and manage company events.
- CB_Events_Contest
- CB_Events_Contest class.
- CB_Events_Event
- Handles the creation and management of events.
- CB_Notifications_Component
- Formats Confetti Bits Notifications.
- CB_Participation_Component
- CB Participation Component
- CB_Participation_Participation
- CB Participation Participation
- CB_Requests_Component
- A component class that gives us access to important globals throughout the app.
- CB_Requests_Request_Item
- A component that allows users to submit requests to cash in their points.
- CB_Requests_Request
- A component that allows users to submit requests to cash in their points.
- CB_Transactions_Component
- Adds component globals and includes related files.
- CB_Transactions_Spot_Bonus
- A component that allows certain users to schedule spot bonuses.
- CB_Transactions_Transaction
- CB Transactions Transaction
- Confetti_Bits
- Confetti Bits Class.
Constants
- CONFETTI_BITS_AJAX_SLUG = 'cb-ajax'
- CONFETTI_BITS_EVENTS_SLUG = 'events'
- CONFETTI_BITS_PARTICIPATION_SLUG = 'participation'
- CONFETTI_BITS_REQUEST_ITEMS_SLUG = 'request-items'
- CONFETTI_BITS_REQUESTS_SLUG = 'requests'
- CONFETTI_BITS_TRANSACTIONS_SLUG = 'transactions'
Functions
- cb_ajax_new_contests() : mixed
- Accepts either a singular contest object or an array of contest objects and adds them to the database.
- cb_ajax_update_contests() : mixed
- Updates contest objects for a given event.
- cb_ajax_delete_contests() : mixed
- Deletes existing contest objects from the database.
- cb_ajax_get_contests() : mixed
- Retrieves contest objects from the database.
- cb_ajax_new_events() : mixed
- Creates a new event object and saves it to the database.
- cb_ajax_update_events() : mixed
- Updates an existing event object and saves it to the database.
- cb_ajax_delete_events() : mixed
- Deletes an existing event object from the database.
- cb_ajax_get_events() : mixed
- Retrieves event objects from the database.
- cb_ajax_get_event_participants() : mixed
- Retrieves a list of participants for a given event.
- cb_ajax_new_contest() : mixed
- Saves contest placements for a given event.
- cb_ajax_get_bda() : mixed
- cb_ajax_new_bda() : mixed
- cb_ajax_update_bda() : mixed
- cb_ajax_delete_bda() : mixed
- cb_ajax_register_rest_route() : mixed
- Dynamically registers a REST route.
- cb_setup_gh_commit_notifications() : mixed
- Adds a REST endpoint so we can send out updates to the team with each commit.
- cb_handle_gh_commits() : mixed
- cb_setup_ajax() : mixed
- Loads our AJAX component, so we can play nice with Javascript.
- 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_ajax_update_request_items() : mixed
- Handles HTTP PATCH request_items to update request_items entries.
- cb_ajax_new_request_items() : mixed
- CB Ajax New Request Items
- cb_ajax_delete_request_items() : int
- Deletes request items from the request items table.
- cb_ajax_get_request_items() : mixed
- CB AJAX Get Request_items
- cb_request_items_add_filler_data() : mixed
- Adds 5 request_items entries for testing purposes.
- cb_ajax_update_requests() : mixed
- Handles HTTP PATCH requests to update requests entries.
- cb_ajax_new_requests() : mixed
- CB Ajax New Requests
- cb_ajax_get_requests() : mixed
- CB AJAX Get Requests
- cb_ajax_delete_requests() : int
- Deletes requests from the requests table.
- cb_dev_func_add_spot_bonuses() : mixed
- cb_ajax_new_spot_bonuses() : mixed
- Creates a new spot bonus and saves it to the database.
- cb_ajax_update_spot_bonuses() : mixed
- Updates an existing spot bonus and saves it to the database.
- cb_ajax_delete_spot_bonuses() : mixed
- Deletes an existing spot bonus from the database.
- cb_ajax_get_spot_bonuses() : mixed
- Retrieves spot bonuses from the database.
- cb_ajax_get_transactions() : JSON
- CB AJAX Get Transactions
- cb_ajax_new_transactions() : mixed
- CB AJAX New Transactions
- cb_ajax_update_volunteers() : mixed
- cb_ajax_get_volunteers() : mixed
- cb_ajax_delete_volunteers() : mixed
- cb_ajax_new_volunteers() : mixed
- Creates a new spot bonus and saves it to the database.
- cb_core_admin_setting_general_register_fields() : mixed
- CB Core Admin Settings General Register Fields
- cb_core_admin_components_settings() : mixed
- cb_admin_components_options() : mixed
- cb_core_set_role_globals() : mixed
- Sets some useful globals for specialized roles for later use.
- cb_core_add_admin_caps() : mixed
- Grants all capabilities to administrator users.
- cb_core_current_user_can() : bool
- An alias for current_user_can()
- cb_core_is_component_admin() : bool
- Checks whether a user is an admin of the given component.
- cb_is_user_admin() : bool
- Checks whether user has certain administrative privileges.
- cb_is_user_executive() : mixed
- Checks to see if the user is an executive user.
- cb_is_user_site_admin() : bool
- Checks if the user has site admin privileges.
- cb_core_admin_is_user_site_admin() : bool
- CB Core Admin Is User Site Admin
- cb_core_admin_is_user_admin() : bool
- Checks whether a user has the cb_admin capability.
- cb_is_user_participation_admin() : bool
- Checks to see if the user is a participation admin.
- cb_is_user_requests_admin() : bool
- Checks to see if the user is a requests admin.
- cb_is_user_staffing_admin() : bool
- Checks to see if the user is a staffing admin.
- cb_is_user_events_admin() : bool
- Checks to see if the user is an events admin.
- editor_manage_users() : mixed
- Let Editors manage users, and run this only once.
- get_rid_of_the_menus() : mixed
- Remove privileged menus from the admin area.
- cb_core_set_uri_globals() : mixed
- Sets a global based on the current URI.
- cb_is_current_component() : bool
- Does an entire song and dance to see if this is the component you want.
- cb_is_confetti_bits_component() : bool
- Asks the wizard if we could have some porridge.
- cb_is_user() : mixed
- Checks whether there is a currently logged-in user.
- cb_is_user_confetti_bits() : bool
- Checks to see if we're in the land of wonder.
- cb_core_get_active_components() : array<string|int, mixed>
- Gives us an array of all active components.
- cb_admin_enqueue_scripts() : mixed
- Fires the cb_admin_enqueue_scripts action, where plugins can enqueue admin scripts.
- cb_loaded() : mixed
- Fires the cb_loaded action, where plugins can load their files.
- cb_init() : mixed
- Fires the cb_init action, where plugins can initialize their components.
- cb_customize_register() : mixed
- Fires the cb_customize_register action, where plugins can register their customizer settings.
- cb_ready() : mixed
- Fires the cb_ready action, where plugins can do things after the CB plugin is ready.
- cb_setup_current_user() : mixed
- Fires the cb_setup_current_user action, where plugins can do things after the current user is setup.
- cb_setup_theme() : mixed
- Fires the cb_setup_theme action, where plugins can modify what happens while the theme is being setup.
- cb_after_setup_theme() : mixed
- Fires the cb_after_setup_theme action, where plugins can do things after the theme is setup.
- cb_enqueue_scripts() : mixed
- Fires the cb_enqueue_scripts action, where plugins can register their front-end scripts.
- cb_template_redirect() : mixed
- Fires the cb_template_redirect action, where plugins can do things before the template is loaded.
- cb_widgets_init() : mixed
- Fires the cb_widgets_init action, where plugins can register their widgets.
- cb_generate_rewrite_rules() : mixed
- Fires the cb_generate_rewrite_rules action, where plugins can add their rewrite rules.
- cb_setup_components() : mixed
- Fires the cb_setup_components action, where plugins can register their components.
- cb_include() : mixed
- Fires the cb_include action, where plugins can include their files.
- cb_register_post_types() : mixed
- Fires the cb_register_post_types action, where plugins can register their post types.
- cb_register_taxonomies() : mixed
- Fires the cb_register_taxonomies action, where plugins can register their taxonomies.
- cb_setup_globals() : mixed
- Fires the cb_setup_globals action, where plugins can register their globals.
- cb_setup_canonical_stack() : mixed
- Fires the cb_setup_canonical_stack action, where plugins can register their canonical stack.
- cb_setup_nav() : mixed
- Fires the cb_setup_nav action, where plugins can register their nav items.
- cb_setup_title() : mixed
- Fires the cb_setup_title action, where plugins can register their title.
- cb_add_rewrite_tags() : mixed
- Fires the cb_add_rewrite_tags action, where plugins can add their rewrite tags.
- cb_add_rewrite_rules() : mixed
- Fires the cb_add_rewrite_rules action, where plugins can add their rewrite rules.
- cb_add_permastructs() : mixed
- Fires the cb_add_permastructs action, where plugins can add their permastructs.
- cb_register_member_types() : mixed
- Fires the cb_register_member_types action, where plugins can register their member types.
- cb_actions() : mixed
- Fires the cb_actions action, where plugins can register their actions.
- cb_screens() : mixed
- Fires the cb_screens action, where plugins can register their screens.
- cb_late_include() : mixed
- Fires the cb_late_include action, where plugins can add include files after the canonical stack has been established.
- cb_post_request() : mixed
- Fires the cb_post_request action, where plugins can register their post requests.
- cb_get_request() : mixed
- Fires the cb_get_request action, where plugins can register their get requests.
- cb_head() : mixed
- Fires the cb_head action, where plugins can register their head items.
- cb_request() : mixed
- Fires the cb_request action, where plugins can modify their queries.
- cb_login_redirect() : mixed
- Fires the cb_login_redirect action, where plugins can modify the login redirect.
- cb_template_include() : mixed
- Fires the cb_template_include action, where plugins can modify the template.
- cb_allowed_themes() : mixed
- Fires the cb_allowed_themes action, where plugins can modify the allowed themes.
- cb_rest_api_init() : mixed
- Fires the cb_rest_api_init action, so we (and others) can easily hook into our REST API.
- cb_core_install_events() : mixed
- CB Core Install Events
- cb_core_install_spot_bonuses() : mixed
- Installs our spot bonus table on the database.
- cb_core_install_transactions() : mixed
- CB Core Install Transactions
- cb_core_install_participation() : mixed
- CB Core Install Participation
- cb_core_install_contests() : mixed
- CB Core Install Contests
- cb_core_install_request_items() : mixed
- CB Core Install Request Items
- cb_core_install_requests() : mixed
- CB Core Install Requests
- cb_core_prepare_install() : mixed
- Put stuff here that you want to run before installation.
- cb_core_install() : mixed
- Installs all our tables on the database.
- cb_setup_core() : mixed
- Sets up our Core component, which loads all of our other components.
- cb_core_generate_uuid() : string
- CB Core Generate UUID
- cb_core_set_api_key() : string
- CB Core Set API Key
- cb_core_get_api_key() : string
- CB Core Get API Key
- cb_core_secrets_manager_init() : string
- CB Core Secrets Manager Init
- cb_core_update_api_key() : string
- CB Core Update API Key
- cb_core_validate_api_key() : bool
- Validates against a supplied API key safe name.
- cb_member_locate_template_part() : string
- CB Member Locate Template Part
- cb_member_get_template_part() : An
- CB Member Get Template Part
- cb_get_active_templates() : An
- Confetti Bits Get Active Templates
- cb_member_template_part() : mixed
- Renders the member template part appropriate for the current page.
- cb_core_add_confetti_captain_badges() : mixed
- Adds Confetti Captain badges to the user's member profile page as well as to the activity feed, if they are a Confetti Captain.
- cb_core_confetti_captain_class() : mixed
- Adds our custom 'confetti-captain' class to the BuddyBoss user avatar so that we can add a cute little sparkler icon using JS.
- cb_core_confetti_captain_profile_badge() : mixed
- Adds a cute litte sparkler badge on the profile page of users who are designated as "Confetti Captains", which meand they are part of the Confetti Captains group.
- cb_events_new_event() : mixed
- Saves a new event to the database.
- cb_events_new_notifications() : mixed
- Sends out notifications when a new event is created.
- cb_events_update_notifications() : mixed
- CB Events Update Notifications
- cb_setup_events() : mixed
- CB Setup Events
- cb_events_format_notifications() : mixed
- cb_events_notifications() : mixed
- cb_events_get_calendar_header() : string
- Gets markup for the calendar header.
- cb_events_get_calendar_view() : string
- Outputs a calendar view of events.
- cb_events_calendar_view() : mixed
- Outputs the markup for the calendar view.
- cb_events_get_list_view() : mixed
- Gets the markup for the events list view.
- cb_events_list_view() : mixed
- Outputs the markup for the events list view.
- cb_events_rewrite_rules() : mixed
- Adds rewrite rules to the events component so we don't get a false 404 when we update plugins.
- cb_events_add_query_vars() : mixed
- cb_events_template_include() : mixed
- cb_events_get_form_module() : string
- Returns markup for a create or update form, determined by the given string.
- cb_events_get_new_event_module() : mixed
- Gets the markup for the new events form module.
- cb_events_new_event_module() : mixed
- Outputs the markup for the new events module.
- cb_events_get_edit_event_module() : mixed
- Returns markup for the edit_event form module.
- cb_events_edit_event_module() : mixed
- Outputs markup for the edit_events module.
- cb_events_admin_table_module() : mixed
- Adds a table for spot bonuses to the transactions tab.
- 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
- cb_setup_participation() : mixed
- CB Setup Participation
- cb_participation_format_notifications() : mixed
- 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.
- cb_requests_new_request() : mixed
- CB Requests Create Requests
- cb_requests_new_transaction() : int|string
- CB Requests New Transaction
- cb_requests_get_amount() : int
- Attempts to extract a predetermined value from a request item.
- cb_requests_get_item_name() : string
- Gets the name of a request item.
- cb_requests_get_request_items() : array<string|int, mixed>
- Lists all available request items.
- cb_requests_get_transaction() : array<string|int, mixed>|bool
- Gets a transaction object, if any are associated with a request.
- cb_requests_get_requests() : mixed
- Gets an array of requests from the database.
- cb_requests_get_active_request_total() : int
- Returns the total amount of points the user has in open requests.
- cb_requests_can_request() : bool
- Checks to see if a user can request the given item.
- cb_requests_can_update() : bool
- Checks to see if a user can update their request item.
- cb_requests_new_notifications() : mixed
- Sends a notification email when a request comes in.
- cb_setup_requests() : mixed
- CB Setup Requests
- cb_bits_request_sender_email_notification() : mixed
- CB Bits Request Sender Email Notification
- cb_requests_new_request_notifications() : mixed
- Sends out notifications whenever someone submits a new request.
- cb_requests_admin_new_request_notifications() : mixed
- Sends notifications to request admins after a new request is sent in.
- cb_requests_leadership_new_request_notifications() : mixed
- Sends notifications to leadership after a new request is sent in.
- cb_requests_site_admins_new_request_notifications() : mixed
- Sends notifications to site admins after a new request is sent in.
- cb_requests_update_request_notifications() : mixed
- Notifies a user when their request status is updated.
- cb_requests_format_notifications() : mixed
- cb_requests_nav() : mixed
- CB Requests Nav
- cb_requests_format_nav_data() : array<string|int, mixed>
- CB Requests Format Nav Data
- cb_requests_get_nav() : string
- CB Requests Get Nav
- cb_requests_admin_nav() : mixed
- CB Requests Admin Nav
- cb_requests_admin_get_nav() : string
- CB Requests Admin Get Nav
- cb_requests_get_request_items_form() : string
- Gets markup for the request items form.
- cb_request_items_form() : mixed
- Outputs markup for request items form.
- cb_requests_get_requests_form() : string
- Gets markup for the request items form.
- cb_requests_form() : mixed
- Outputs markup for request items form.
- cb_templates_get_text_input() : mixed
- CB Templates Get Text Input
- cb_text_input() : mixed
- CB Text Input
- cb_templates_get_select_input() : mixed
- CB Templates Get Select Input
- cb_templates_get_select_options() : mixed
- CB Templates Get Select Options
- cb_select_input() : mixed
- Confetti Bits Select Input
- cb_templates_get_number_input() : mixed
- CB Templates Get Number Input
- cb_number_input() : mixed
- CB Number Input
- cb_templates_get_file_input() : mixed
- Confetti Bits Get File Input.
- cb_file_input() : mixed
- Confetti Bits File Input
- cb_templates_get_submit_input() : mixed
- CB Templates Get Submit Input.
- cb_submit_input() : mixed
- CB Submit Input
- cb_templates_get_hidden_input() : mixed
- CB Templates Get Hidden Input
- cb_hidden_input() : mixed
- CB Hidden Input
- cb_templates_get_checkbox_input() : mixed
- CB Templates Get Checkbox Input
- cb_checkbox_input() : mixed
- CB Checkbox Input
- cb_templates_get_dropzone_input() : mixed
- CB Format Dropzone Input
- cb_dropzone_input() : mixed
- CB Dropzone Input
- cb_templates_get_toggle_switch() : mixed
- Alias for cb_templates_get_toggle_switch_input().
- cb_templates_get_toggle_switch_input() : string
- Gets markup for a toggle switch input.
- cb_toggle_switch() : mixed
- CB Toggle Switch
- cb_templates_get_form() : string
- CB Templates Get Form
- cb_form() : mixed
- Outputs the markup for a form element.
- cb_templates_get_form_module() : string
- Gets the markup for a form module.
- cb_templates_get_form_button() : string
- Returns formatted markup for a form button. Note that this should not be used as a submit button; we typically use input[type=submit] for that functionality. Here we'll default to button[type=button] to ensure that we can have it do what we want and not make the app have a heart attack.
- cb_form_module() : mixed
- Outputs the form module's markup.
- cb_templates_get_form_output() : mixed
- Dynamically populates markup and input elements for a form.
- cb_templates_recursive_helper() : string
- A recursive helper function to help us process complex content trees.
- cb_templates_get_time_picker_input() : string
- Gets markup for a time picker.
- cb_time_picker_input() : mixed
- Outputs markup for a time picker.
- cb_templates_get_date_picker_input() : string
- Gets markup for a date picker input.
- cb_templates_get_datetime_picker_input() : string
- Gets markup for both date and time inputs on one line.
- cb_datetime_picker() : mixed
- Outputs markup for a datetime picker input.
- cb_templates_get_datetime_local_input() : string
- Formats markup for a datetime-local input.
- cb_datetime_local_input() : mixed
- Outputs markup for a datetime-local input.
- cb_templates_get_date_input() : mixed
- Outputs markup for an actually nice date input. Uses Bootstrap styling and plugs in some custom data based on arguments passed.
- cb_date_input() : mixed
- Outputs markup for a pretty date input.
- cb_templates_get_time_selector_input() : mixed
- cb_time_selector_input() : mixed
- cb_templates_container() : string
- CB Templates Container
- cb_templates_get_button() : string
- Formats a button element with the given arguments
- cb_templates_get_list_item() : string
- Formats a list item element with the given arguments
- cb_templates_get_link() : string
- CB Templates Get Link
- cb_templates_get_table() : mixed
- cb_templates_get_ajax_table() : string|void
- CB Templates AJAX Table
- cb_templates_ajax_table() : mixed
- Outputs markup for an AJAX table.
- cb_templates_get_pagination() : string|void
- CB Get Pagination
- cb_templates_get_heading() : string
- Formats the markup for a heading element.
- cb_templates_heading() : mixed
- CB Templates Heading
- cb_templates_get_nav_items() : string
- CB Templates Get Nav Items
- cb_templates_get_nav() : string
- CB Templates Get Nav
- cb_transactions_get_history_for_user() : mixed
- CB Transactions Get History for User
- cb_csv_send_headers() : mixed
- CB CSV Send Headers
- cb_generate_csv() : mixed
- CB Generate CSV
- cb_export() : mixed
- CB Export
- cb_activity_bits() : mixed
- CB Activity Bits
- cb_transactions_get_total_sent_today() : int
- CB Transactions Get Total Sent Today
- cb_transactions_get_request_balance() : int
- CB Transactions Get Request Balance
- cb_transactions_get_transfer_balance() : int
- CB Transactions Get Transfer Balance
- cb_transactions_check_activity_bits() : mixed
- CB Transactions Check Activity Bits
- cb_transactions_get_activity_posts() : array<string|int, mixed>
- CB Transactions Get Activity Posts
- cb_transactions_get_activity_transactions() : array<string|int, mixed>
- CB Transactions Get Activity Transactions
- cb_transactions_calculate_activity_bits() : array<string|int, mixed>
- CB Transactions Calculate Activity Bits
- cb_transactions_has_bits() : bool
- CB Transactions Has Bits
- cb_transactions_birthday_bits() : mixed
- CB Transactions Birthday Bits
- cb_transactions_anniversary_bits() : mixed
- CB Transactions Anniversary Bits
- cb_transactions_get_amount_from_anniversary() : int
- CB Transactions Get Amount From Anniversary
- cb_transactions_get_leaderboard() : array<string|int, mixed>
- CB Transactions Get Leaderboard
- cb_transactions_delete_transaction() : int
- CB Transactions Delete Transaction
- cb_transactions_new_transaction() : mixed
- CB Transactions New Transaction
- cb_transactions_remove_bits() : mixed
- CB Transactions Remove Bits
- cb_transactions_new_events_transaction() : int|bool|string
- A supplemental helper function that will let us process event-based transactions without modifying existing API stuff too much.
- cb_transactions_new_contests_transaction() : int|bool|string
- A supplemental helper function that will let us process contest-based transactions without modifying existing API stuff too much.
- cb_import_bits() : mixed
- CB Import Bits
- cb_importer() : mixed
- Confetti Bits Importer
- cb_import_bda() : mixed
- CB Import BDA
- cb_bda_importer() : mixed
- CB BDA Importer
- cb_setup_transactions() : mixed
- CB Setup Transactions
- cb_groups_activity_notifications() : mixed
- Sends a notification to members of a group when someone posts.
- cb_transactions_notifications() : int|bool
- Sends transaction notifications based on component action.
- cb_transactions_format_notifications() : mixed
- cb_groups_format_notifications() : mixed
- cb_transactions_spot_bonus_notifications() : mixed
- cb_transactions_volunteer_bits_notifications() : mixed
- cb_transactions_get_total_sent_today_notice() : string
- Gets the total number of Confetti Bits that have been sent for the current day and returns a notice to the user.
- cb_transactions_total_sent_today_notice() : mixed
- Output the total number of Confetti Bits that the user has sent for the current day.
- cb_transactions_request_balance() : mixed
- Display the users request balance.
- cb_transactions_get_request_balance_notice() : string
- Get the users request balance notice.
- cb_transactions_request_balance_notice() : mixed
- Output the users request balance notice.
- cb_transactions_get_balances_notice() : string
- CB Transactions Balances Notice
- cb_transactions_balances_notice() : mixed
- CB Transactions Balances Notice
- cb_transactions_get_transfer_balance_notice() : string
- CB Transactions Get Transfer Balance Notice
- cb_transactions_get_balance_notice() : string
- Dynamically gets the markup for the balance notice at the top of the dashboard.
- cb_transactions_balance_notice() : mixed
- Outputs a balance notice of the given type, for the given user.
- cb_transactions_transfer_balance_notice() : mixed
- CB Transactions Transfer Balance Notice
- cb_transactions_get_request_selection() : string
- CB Transactions Get Request Selection
- cb_transactions_request_selection() : mixed
- Outputs markup for the request selector.
- cb_transactions_get_leaderboard_module() : string
- Returns container markup with transactions leaderboard content inside.
- cb_transactions_leaderboard_module() : mixed
- Outputs the markup for the Confetti Bits leaderboard module.
- cb_transactions_get_send_bits_module() : string
- Gets the containerized markup for the send bits module on the Confetti Bits dashboard.
- cb_transactions_send_bits_module() : mixed
- Outputs the markup for the send bits module.
- cb_transactions_get_formatted_leaderboard() : string
- Returns a string of markup that contains listings for the top 15 users with the most Confetti Bits.
- cb_transactions_leaderboard() : mixed
- Outputs markup for the transactions leaderboard.
- cb_transactions_get_import_bda_module() : string
- Formats the markup for the "Import Birthdays" module.
- cb_import_bda_module() : mixed
- Outputs the "Import B-Days & Anniversaries" markup.
- cb_transactions_get_spot_bonus_module() : mixed
- cb_transactions_get_volunteers_module() : mixed
- cb_transactions_spot_bonus_table_module() : mixed
- Adds a table for spot bonuses to the transactions tab.
- cb_transactions_spot_bonus_module() : mixed
- Adds the spot bonus form to the transactions tab.
- cb_transactions_volunteer_hours_module() : mixed
- Confetti_Bits() : Confetti_Bits
- The main function responsible for returning the one true Confetti_Bits
- cb_install_bb_platform_notice() : mixed
- Display notice if BuddyBoss Platform is not installed.
- cb_update_bb_platform_notice() : mixed
- Display notice if BuddyBoss Platform is not updated.
- cb_bp_is_active() : mixed
- Check if Confetti Bits is active.
- cb_plugin_init() : void
- Init the plugin.
- cb_is_get_request() : bool
- CB Is Get Request
- cb_is_post_request() : bool
- CB Is Post Request
- cb_is_patch_request() : bool
- CB Is Patch Request
- cb_is_delete_request() : bool
- CB Is Delete Request
- confetti_bits_admin_enqueue_script() : mixed
- cb_core_notifications_init() : mixed
- Initializes our notifications class.
- cb_user_birthday_anniversary_fields() : mixed
- Returns form markup that allows privileged users to manually input the birthday and anniversary dates for other users.
- cb_save_user_birthday_anniversary_fields() : mixed
- cb_core_set_reset_date_globals() : mixed
- CB Core Set Reset Date Globals
- cb_core_set_spot_bonus_global() : mixed
- Sets the amount for spot bonuses in our core class for easy access.
- cb_core_auto_reset() : mixed
- Automatically increments the reset date by 1 year.
- cb_core_current_date() : string
- CB Core Current Date
- str_starts_with() : bool
- Str Starts With
- str_ends_with() : bool
- Str Ends With
- str_contains() : bool
- Str Contains
- cb_flush_rewrite_rules() : mixed
- CB Flush Rewrite Rules
- cb_get_patch_data() : array<string|int, mixed>
- Gets PATCH data from an HTTP PATCH request.
- cb_get_delete_data() : array<string|int, mixed>
- Gets DELETE data from an HTTP DELETE request.
- cb_core_get_missing_users() : array<string|int, mixed>
- Gets a list of transactions for nonexistent users.
- cb_core_get_user_display_name() : string
- Gets the user display name.
- cb_core_get_user_email() : string
- Returns the email address for the given user.
- cb_core_is_multi_array() : bool
- Checks if the parameter is a multi-dimensional array.
- cb_core_send_sitewide_notice() : mixed
- Sends out a sitewide notice.
- cb_core_get_doomsday_clock() : int
- Returns the number of days remaining until the reset date.
- cb_core_sanitize_string() : string
- Washes away the sins of bad actors.
- cb_core_smtp_init() : mixed
- Injects our own config settings into PHPMailer.
- cb_core_admin_menu() : mixed
- Adds a menu item for our settings.
- cb_templates_get_admin_page() : string
- Formats markup for our admin settings page.
- cb_core_admin_page() : mixed
- Outputs markup for our admin settings page.
- cb_core_admin_settings_init() : mixed
- cb_core_admin_settings_sanitize() : string
- Will eventually be used to sanitize user input in the admin menu.
- cb_core_admin_settings_section_callback() : string
- Returns the content for our main settings section.
- cb_core_admin_reset_date_setting() : mixed
- Outputs the setting field for the reset date.
- cb_core_admin_volunteer_setting() : mixed
- Outputs the setting field for the volunteer amount per hour.
- cb_core_admin_spot_bonus_setting() : mixed
- Outputs the setting field for the volunteer amount per hour.
- cb_core_convert_scripts_to_modules() : mixed
- Replaces our default script tags with modules.
- cb_core_delete_user_data() : mixed
- Deletes all Confetti Bits data associated with deleted user.
- cb_core_do_spot_bonuses() : mixed
- cb_core_listify() : mixed
- cb_core_schedule_events() : mixed
- cb_core_utc_to_local() : mixed
- cb_core_ordinal_suffix() : string
- Adds an ordinal suffix to a given integer.
Constants
CONFETTI_BITS_AJAX_SLUG
public
mixed
CONFETTI_BITS_AJAX_SLUG
= 'cb-ajax'
CONFETTI_BITS_EVENTS_SLUG
public
mixed
CONFETTI_BITS_EVENTS_SLUG
= 'events'
CONFETTI_BITS_PARTICIPATION_SLUG
public
mixed
CONFETTI_BITS_PARTICIPATION_SLUG
= 'participation'
CONFETTI_BITS_REQUEST_ITEMS_SLUG
public
mixed
CONFETTI_BITS_REQUEST_ITEMS_SLUG
= 'request-items'
CONFETTI_BITS_REQUESTS_SLUG
public
mixed
CONFETTI_BITS_REQUESTS_SLUG
= 'requests'
CONFETTI_BITS_TRANSACTIONS_SLUG
public
mixed
CONFETTI_BITS_TRANSACTIONS_SLUG
= 'transactions'
Functions
cb_ajax_new_contests()
Accepts either a singular contest object or an array of contest objects and adds them to the database.
cb_ajax_new_contests() : mixed
Tags
cb_ajax_update_contests()
Updates contest objects for a given event.
cb_ajax_update_contests() : mixed
I'm a goofy goober. I ended up making this a lot more dynamic so it can handle a lot of different user interactions.
Sit back and enjoy, friend.
It's important to note that we aren't necessarily always modifying a singular contest object within the database. Here's a breakdown of what's going on here:
Arguments
- An event_id
- An array of contest objects, with 'placement' and 'amount' keys
- An API key
Data Logistics
- Validate that we meet all the above constraints.
- Validate that the event actually exists in the database.
- Loop through the contests, and within that loop: a. Validate that we have both a placement and an amount. b. Check to see if that placement exists, and update it if so. c. If the placement doesn't exist, we'll create one.
Should be fairly straightforward, but I've been wrong so many times before. ~~We might just run everything through the new_contests endpoint~~ ~~We're almost definitely going to be running updates through the new_contests endpoint.~~
We are absolutely not running updates through the new_contests endpoint.
Tags
cb_ajax_delete_contests()
Deletes existing contest objects from the database.
cb_ajax_delete_contests() : mixed
Tags
cb_ajax_get_contests()
Retrieves contest objects from the database.
cb_ajax_get_contests() : mixed
Typically used to retrieve a list of placements based on a given event_id.
Tags
cb_ajax_new_events()
Creates a new event object and saves it to the database.
cb_ajax_new_events() : mixed
Tags
cb_ajax_update_events()
Updates an existing event object and saves it to the database.
cb_ajax_update_events() : mixed
Tags
cb_ajax_delete_events()
Deletes an existing event object from the database.
cb_ajax_delete_events() : mixed
Tags
cb_ajax_get_events()
Retrieves event objects from the database.
cb_ajax_get_events() : mixed
Tags
cb_ajax_get_event_participants()
Retrieves a list of participants for a given event.
cb_ajax_get_event_participants() : mixed
Tags
cb_ajax_new_contest()
Saves contest placements for a given event.
cb_ajax_new_contest() : mixed
Tags
cb_ajax_get_bda()
cb_ajax_get_bda() : mixed
cb_ajax_new_bda()
cb_ajax_new_bda() : mixed
cb_ajax_update_bda()
cb_ajax_update_bda() : mixed
cb_ajax_delete_bda()
cb_ajax_delete_bda() : mixed
cb_ajax_register_rest_route()
Dynamically registers a REST route.
cb_ajax_register_rest_route([string $component = '' ]) : mixed
Parameters
- $component : string = ''
-
The component to register a route for.
Tags
cb_setup_gh_commit_notifications()
Adds a REST endpoint so we can send out updates to the team with each commit.
cb_setup_gh_commit_notifications() : mixed
cb_handle_gh_commits()
cb_handle_gh_commits(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
cb_setup_ajax()
Loads our AJAX component, so we can play nice with Javascript.
cb_setup_ajax() : mixed
Tags
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_ajax_update_request_items()
Handles HTTP PATCH request_items to update request_items entries.
cb_ajax_update_request_items() : mixed
Processes standard and bulk request_items updates from an HTTP PATCH request.
Tags
cb_ajax_new_request_items()
CB Ajax New Request Items
cb_ajax_new_request_items() : mixed
We'll use this to process the new request_items entries sent via ajax.
Tags
cb_ajax_delete_request_items()
Deletes request items from the request items table.
cb_ajax_delete_request_items() : int
Tags
Return values
int —The number of rows affected, or false on failure.
cb_ajax_get_request_items()
CB AJAX Get Request_items
cb_ajax_get_request_items() : mixed
Our REST API handler for the endpoint at "/wp-json/cb-ajax/v1/request_items/get"
Tags
cb_request_items_add_filler_data()
Adds 5 request_items entries for testing purposes.
cb_request_items_add_filler_data() : mixed
Tags
cb_ajax_update_requests()
Handles HTTP PATCH requests to update requests entries.
cb_ajax_update_requests() : mixed
Processes standard and bulk requests updates from an HTTP PATCH request.
Tags
cb_ajax_new_requests()
CB Ajax New Requests
cb_ajax_new_requests() : mixed
We'll use this to process the new requests entries sent via ajax.
Tags
cb_ajax_get_requests()
CB AJAX Get Requests
cb_ajax_get_requests() : mixed
Our REST API handler for the endpoint at "/wp-json/cb-ajax/v1/requests/get"
Tags
cb_ajax_delete_requests()
Deletes requests from the requests table.
cb_ajax_delete_requests() : int
Tags
Return values
int —The number of rows affected, or false on failure.
cb_dev_func_add_spot_bonuses()
cb_dev_func_add_spot_bonuses() : mixed
cb_ajax_new_spot_bonuses()
Creates a new spot bonus and saves it to the database.
cb_ajax_new_spot_bonuses() : mixed
Tags
cb_ajax_update_spot_bonuses()
Updates an existing spot bonus and saves it to the database.
cb_ajax_update_spot_bonuses() : mixed
Tags
cb_ajax_delete_spot_bonuses()
Deletes an existing spot bonus from the database.
cb_ajax_delete_spot_bonuses() : mixed
Tags
cb_ajax_get_spot_bonuses()
Retrieves spot bonuses from the database.
cb_ajax_get_spot_bonuses() : mixed
Tags
cb_ajax_get_transactions()
CB AJAX Get Transactions
cb_ajax_get_transactions() : JSON
Gets transactions for a user based on the user_id passed in the $_GET array.
Tags
Return values
JSON —{ 'text': JSON (JSON encoded array of transactions, or error message), 'type': string (success or error) }
cb_ajax_new_transactions()
CB AJAX New Transactions
cb_ajax_new_transactions() : mixed
AJAX handler for creating transactions.
All parameters are passed via POST request.
The following parameters are required:
- sender_id (int) - The ID of the user sending the bits.
- recipient_id (int) - The ID of the user receiving the bits.
- amount (int) - The amount of bits to send.
- log_entry (string) - The log entry to record for this transaction.
Tags
cb_ajax_update_volunteers()
cb_ajax_update_volunteers() : mixed
cb_ajax_get_volunteers()
cb_ajax_get_volunteers() : mixed
cb_ajax_delete_volunteers()
cb_ajax_delete_volunteers() : mixed
cb_ajax_new_volunteers()
Creates a new spot bonus and saves it to the database.
cb_ajax_new_volunteers() : mixed
Tags
cb_core_admin_setting_general_register_fields()
CB Core Admin Settings General Register Fields
cb_core_admin_setting_general_register_fields(mixed $setting) : mixed
Registers our settings fields in the general context of
the BuddyBoss settings page environment.
Key part of this is the "bp_admin_setting_{ component }_register_fields"
add_section
is a wordpress method to create the settings section. It requires a setting object.
add_field
is a wordpress method that creates a field within the section we just made.
bp_admin_setting_{ component }_register_fields
handles the rest.
Parameters
- $setting : mixed
Tags
cb_core_admin_components_settings()
cb_core_admin_components_settings() : mixed
cb_admin_components_options()
cb_admin_components_options() : mixed
cb_core_set_role_globals()
Sets some useful globals for specialized roles for later use.
cb_core_set_role_globals() : mixed
The idea here is that once these globals are set, we can access them to grant certain permissions to certain roles, which will help us determine who can see what in our template loop.
Tags
cb_core_add_admin_caps()
Grants all capabilities to administrator users.
cb_core_add_admin_caps() : mixed
Tags
cb_core_current_user_can()
An alias for current_user_can()
cb_core_current_user_can([string $cap = '' ]) : bool
Parameters
- $cap : string = ''
-
The capability to check for.
Tags
Return values
bool —Whether the user has the capability.
cb_core_is_component_admin()
Checks whether a user is an admin of the given component.
cb_core_is_component_admin([string $component = '' ]) : bool
Parameters
- $component : string = ''
-
The component to check for.
Tags
Return values
bool —Whether the user is an admin for the component.
cb_is_user_admin()
Checks whether user has certain administrative privileges.
cb_is_user_admin([mixed $user_id = 0 ]) : bool
These include: - cb_participation_admin - cb_events_admin - cb_requests_admin
It's important to note that the cb_admin capability is shared by both the cb_leadership role as well as the cb_executive role, so checking for this capability will return true for both of those roles, along with users that have the 'administrator' capability.
Parameters
- $user_id : mixed = 0
Tags
Return values
bool —Whether the current user is a cb_admin.
cb_is_user_executive()
Checks to see if the user is an executive user.
cb_is_user_executive() : mixed
This role carries specific, high-level privileges in certain areas of the application, so it exists as its own separate capability.
Tags
cb_is_user_site_admin()
Checks if the user has site admin privileges.
cb_is_user_site_admin([mixed $user_id = 0 ]) : bool
Checks whether a user has administrative privileges. Also, @see cb_core_admin_is_user_site_admin(), because we're deprecating this for the sake of our API and sanity (sorry besties).
Parameters
- $user_id : mixed = 0
Tags
Return values
bool —Whether a user has administrative privileges.
cb_core_admin_is_user_site_admin()
CB Core Admin Is User Site Admin
cb_core_admin_is_user_site_admin([mixed $user_id = 0 ]) : bool
Checks whether a user has administrative privileges.
Parameters
- $user_id : mixed = 0
Tags
Return values
bool —Whether a user has administrative privileges.
cb_core_admin_is_user_admin()
Checks whether a user has the cb_admin capability.
cb_core_admin_is_user_admin([mixed $user_id = 0 ]) : bool
Parameters
- $user_id : mixed = 0
Tags
Return values
bool —Whether a user has cb_admin privileges.
cb_is_user_participation_admin()
Checks to see if the user is a participation admin.
cb_is_user_participation_admin() : bool
Checks whether a user has administrative privileges over the participation component. These privileges are granted by assigning a role on the Edit User admin page.
Tags
Return values
bool —Whether a user is a participation admin.
cb_is_user_requests_admin()
Checks to see if the user is a requests admin.
cb_is_user_requests_admin() : bool
Checks whether a user has administrative privileges over the requests component. These privileges are granted by assigning a role on the Edit User admin page.
Tags
Return values
bool —Whether a user is a requests admin.
cb_is_user_staffing_admin()
Checks to see if the user is a staffing admin.
cb_is_user_staffing_admin() : bool
Checks whether a user has administrative privileges for user moderation. These privileges are granted by assigning a role on the Edit User admin page.
Tags
Return values
bool —Whether a user is a staffing admin.
cb_is_user_events_admin()
Checks to see if the user is an events admin.
cb_is_user_events_admin() : bool
Checks whether a user has administrative privileges over the events component. These privileges are granted by assigning a role on the Edit User admin page.
Tags
Return values
bool —Whether a user is an events admin.
editor_manage_users()
Let Editors manage users, and run this only once.
editor_manage_users() : mixed
Version: 1.0.0
get_rid_of_the_menus()
Remove privileged menus from the admin area.
get_rid_of_the_menus() : mixed
Tags
cb_core_set_uri_globals()
Sets a global based on the current URI.
cb_core_set_uri_globals() : mixed
The goal here at one point was to have each component dynamically registered through the URI and accessible via a stacking path, like this:
https://{{domain}}/{{component}}/{{action}}/{{item}}
This is no easy feat. It would also require some significant shenanigans on our end to make that happen. So we've opted to using REST API endpoints, and just checking whether $cb->current_component exists, and is indeed === 'confetti-bits'.
Tags
cb_is_current_component()
Does an entire song and dance to see if this is the component you want.
cb_is_current_component([string $component = '' ]) : bool
- Checks to see if the current component is the same as the supplied component.
- Checks to see if the supplied component has a slug that matches.
- Checks to see if the supplied component is in the array of active components.
- Checks one last time to see if any of the active components has a slug that matches the supplied component.
Parameters
- $component : string = ''
-
The component to check for.
Tags
Return values
bool —True if it's one of ours, false in any other scenario.
cb_is_confetti_bits_component()
Asks the wizard if we could have some porridge.
cb_is_confetti_bits_component() : bool
Tags
Return values
bool —Whether we may have some porridge.
cb_is_user()
Checks whether there is a currently logged-in user.
cb_is_user() : mixed
Tags
cb_is_user_confetti_bits()
Checks to see if we're in the land of wonder.
cb_is_user_confetti_bits() : bool
Tags
Return values
bool —Whether we're in the land of wonder.
cb_core_get_active_components()
Gives us an array of all active components.
cb_core_get_active_components() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Active components.
cb_admin_enqueue_scripts()
Fires the cb_admin_enqueue_scripts action, where plugins can enqueue admin scripts.
cb_admin_enqueue_scripts() : mixed
Tags
cb_loaded()
Fires the cb_loaded action, where plugins can load their files.
cb_loaded() : mixed
Tags
cb_init()
Fires the cb_init action, where plugins can initialize their components.
cb_init() : mixed
Tags
cb_customize_register()
Fires the cb_customize_register action, where plugins can register their customizer settings.
cb_customize_register(WP_Customize_Manager $customizer) : mixed
Parameters
- $customizer : WP_Customize_Manager
Tags
cb_ready()
Fires the cb_ready action, where plugins can do things after the CB plugin is ready.
cb_ready() : mixed
Tags
cb_setup_current_user()
Fires the cb_setup_current_user action, where plugins can do things after the current user is setup.
cb_setup_current_user() : mixed
Tags
cb_setup_theme()
Fires the cb_setup_theme action, where plugins can modify what happens while the theme is being setup.
cb_setup_theme() : mixed
Tags
cb_after_setup_theme()
Fires the cb_after_setup_theme action, where plugins can do things after the theme is setup.
cb_after_setup_theme() : mixed
Tags
cb_enqueue_scripts()
Fires the cb_enqueue_scripts action, where plugins can register their front-end scripts.
cb_enqueue_scripts() : mixed
Tags
cb_template_redirect()
Fires the cb_template_redirect action, where plugins can do things before the template is loaded.
cb_template_redirect() : mixed
Tags
cb_widgets_init()
Fires the cb_widgets_init action, where plugins can register their widgets.
cb_widgets_init() : mixed
Tags
cb_generate_rewrite_rules()
Fires the cb_generate_rewrite_rules action, where plugins can add their rewrite rules.
cb_generate_rewrite_rules(mixed $wp_rewrite) : mixed
Parameters
- $wp_rewrite : mixed
Tags
cb_setup_components()
Fires the cb_setup_components action, where plugins can register their components.
cb_setup_components() : mixed
Tags
cb_include()
Fires the cb_include action, where plugins can include their files.
cb_include() : mixed
Tags
cb_register_post_types()
Fires the cb_register_post_types action, where plugins can register their post types.
cb_register_post_types() : mixed
Tags
cb_register_taxonomies()
Fires the cb_register_taxonomies action, where plugins can register their taxonomies.
cb_register_taxonomies() : mixed
Tags
cb_setup_globals()
Fires the cb_setup_globals action, where plugins can register their globals.
cb_setup_globals() : mixed
Tags
cb_setup_canonical_stack()
Fires the cb_setup_canonical_stack action, where plugins can register their canonical stack.
cb_setup_canonical_stack() : mixed
Tags
cb_setup_nav()
Fires the cb_setup_nav action, where plugins can register their nav items.
cb_setup_nav() : mixed
Tags
cb_setup_title()
Fires the cb_setup_title action, where plugins can register their title.
cb_setup_title() : mixed
Tags
cb_add_rewrite_tags()
Fires the cb_add_rewrite_tags action, where plugins can add their rewrite tags.
cb_add_rewrite_tags() : mixed
Tags
cb_add_rewrite_rules()
Fires the cb_add_rewrite_rules action, where plugins can add their rewrite rules.
cb_add_rewrite_rules() : mixed
Tags
cb_add_permastructs()
Fires the cb_add_permastructs action, where plugins can add their permastructs.
cb_add_permastructs() : mixed
Tags
cb_register_member_types()
Fires the cb_register_member_types action, where plugins can register their member types.
cb_register_member_types() : mixed
Tags
cb_actions()
Fires the cb_actions action, where plugins can register their actions.
cb_actions() : mixed
Tags
cb_screens()
Fires the cb_screens action, where plugins can register their screens.
cb_screens() : mixed
Tags
cb_late_include()
Fires the cb_late_include action, where plugins can add include files after the canonical stack has been established.
cb_late_include() : mixed
Tags
cb_post_request()
Fires the cb_post_request action, where plugins can register their post requests.
cb_post_request() : mixed
Tags
cb_get_request()
Fires the cb_get_request action, where plugins can register their get requests.
cb_get_request() : mixed
cb_head()
Fires the cb_head action, where plugins can register their head items.
cb_head() : mixed
Tags
cb_request()
Fires the cb_request action, where plugins can modify their queries.
cb_request([mixed $query_vars = array() ]) : mixed
Parameters
- $query_vars : mixed = array()
cb_login_redirect()
Fires the cb_login_redirect action, where plugins can modify the login redirect.
cb_login_redirect([string $redirect_to = '' ][, string $redirect_to_raw = '' ][, WP_User|WP_Error $user = false ]) : mixed
Parameters
- $redirect_to : string = ''
-
The redirect destination URL.
- $redirect_to_raw : string = ''
-
The requested redirect destination URL passed as a parameter.
- $user : WP_User|WP_Error = false
-
WP_User object if login was successful, WP_Error object otherwise.
cb_template_include()
Fires the cb_template_include action, where plugins can modify the template.
cb_template_include([string $template = '' ]) : mixed
Parameters
- $template : string = ''
-
The template to include.
Tags
cb_allowed_themes()
Fires the cb_allowed_themes action, where plugins can modify the allowed themes.
cb_allowed_themes(array<string|int, mixed> $themes) : mixed
Parameters
- $themes : array<string|int, mixed>
-
The allowed themes.
Tags
cb_rest_api_init()
Fires the cb_rest_api_init action, so we (and others) can easily hook into our REST API.
cb_rest_api_init() : mixed
Tags
cb_core_install_events()
CB Core Install Events
cb_core_install_events() : mixed
Installs our events table on the database.
Tags
cb_core_install_spot_bonuses()
Installs our spot bonus table on the database.
cb_core_install_spot_bonuses() : mixed
Tags
cb_core_install_transactions()
CB Core Install Transactions
cb_core_install_transactions() : mixed
Installs our transactions table on the database.
Tags
cb_core_install_participation()
CB Core Install Participation
cb_core_install_participation() : mixed
Installs our transactions table on the database.
Tags
cb_core_install_contests()
CB Core Install Contests
cb_core_install_contests() : mixed
Installs our contests table on the database.
Tags
cb_core_install_request_items()
CB Core Install Request Items
cb_core_install_request_items() : mixed
Installs our request items table on the database.
Tags
cb_core_install_requests()
CB Core Install Requests
cb_core_install_requests() : mixed
Installs our requests table on the database.
Tags
cb_core_prepare_install()
Put stuff here that you want to run before installation.
cb_core_prepare_install() : mixed
Tags
cb_core_install()
Installs all our tables on the database.
cb_core_install([mixed $active_components = array() ]) : mixed
Also flushes the WordPress cache and rewrite rules so that our pages still show up after plugins get updated.
Parameters
- $active_components : mixed = array()
Tags
cb_setup_core()
Sets up our Core component, which loads all of our other components.
cb_setup_core() : mixed
Tags
cb_core_generate_uuid()
CB Core Generate UUID
cb_core_generate_uuid([mixed $bytes = 32 ]) : string
Generates a UUID that we can use to create unique keys and other neat things for API validation and the like. "Cryptographically secure", unless someone is using a quantum computer. In which case... you're really picking this program as the thing you want to hack? Really?
Parameters
- $bytes : mixed = 32
Tags
Return values
string —An RFC 4211 compliant universally unique identifier.
cb_core_set_api_key()
CB Core Set API Key
cb_core_set_api_key([array<string|int, mixed> $args = [] ]) : string
Sets the encryption key that we use to encrypt and decrypt our API key in the database.
Parameters
- $args : array<string|int, mixed> = []
-
{ Array of arguments.
@type string $Name Required. A name for the secret. We hang onto this and use it to pull the secret from our secrets manager.
@type string $Description Optional. A description for the secret. Nice to have if you want, but not entirely necessary.
@type string $SecretString Required. This is a secret! Handle with extreme care. Please.
}
Return values
string —Results of the createSecret method, or error message on failure.
cb_core_get_api_key()
CB Core Get API Key
cb_core_get_api_key([mixed $secret = '' ]) : string
Pulls the API key from our secrets manager. You may wanna study up on AWS!
Parameters
- $secret : mixed = ''
Tags
Return values
string —The API key. Use with caution, share with none.
cb_core_secrets_manager_init()
CB Core Secrets Manager Init
cb_core_secrets_manager_init() : string
Creates our first set of API credentials automatically. Can refresh them at any time via WordPress admin panel.
Tags
Return values
string —The stringified Model data, or error message on failure.
cb_core_update_api_key()
CB Core Update API Key
cb_core_update_api_key() : string
Creates a new API key in our secrets manager and updates its safe name in the options table.
Tags
Return values
string —The stringified Model data, or error message on failure.
cb_core_validate_api_key()
Validates against a supplied API key safe name.
cb_core_validate_api_key([string $safe_name = '' ]) : bool
We work with safe names here. We store the safe name in our DB, and that works as the current valid API key for the current website. If the safe name that gets supplied does not match our safe name, it will fail the test. If the supplied safe name matches, it will then search our secrets manager for a valid API key. If one is not found, or it is expired or invalid, it will also fail.
Parameters
- $safe_name : string = ''
-
The safe name for our API key.
Tags
Return values
bool —Whether the API key exists and is valid.
cb_member_locate_template_part()
CB Member Locate Template Part
cb_member_locate_template_part([string $template = '' ]) : string
Attempts to locate the specified template in the TeamCTG Child Theme, located at '/cb-template-parts/cb-{$template}.php'.
Parameters
- $template : string = ''
-
The template to look for.
Tags
Return values
string —The template, if found.
cb_member_get_template_part()
CB Member Get Template Part
cb_member_get_template_part([mixed $template = '' ]) : An
Loads a template part based on the template that gets passed in.
Parameters
- $template : mixed = ''
Tags
Return values
An —array of the active templates.
cb_get_active_templates()
Confetti Bits Get Active Templates
cb_get_active_templates() : An
Sets up the templates to show users based on permissions.
Tags
Return values
An —array of the active templates.
cb_member_template_part()
Renders the member template part appropriate for the current page.
cb_member_template_part() : mixed
Right now? We only have the one page. Oof.
Tags
cb_core_add_confetti_captain_badges()
Adds Confetti Captain badges to the user's member profile page as well as to the activity feed, if they are a Confetti Captain.
cb_core_add_confetti_captain_badges() : mixed
Tags
cb_core_confetti_captain_class()
Adds our custom 'confetti-captain' class to the BuddyBoss user avatar so that we can add a cute little sparkler icon using JS.
cb_core_confetti_captain_class(mixed $class, mixed $item_id) : mixed
Parameters
- $class : mixed
- $item_id : mixed
Tags
cb_core_confetti_captain_profile_badge()
Adds a cute litte sparkler badge on the profile page of users who are designated as "Confetti Captains", which meand they are part of the Confetti Captains group.
cb_core_confetti_captain_profile_badge() : mixed
Tags
cb_events_new_event()
Saves a new event to the database.
cb_events_new_event([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments. Accepts any parameters of a CB_Events_Event object. }
cb_events_new_notifications()
Sends out notifications when a new event is created.
cb_events_new_notifications([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
{ An associative array of key => value pairs from a CB_Events_Event object.
@see CB_Events_Event::save()
}
Tags
cb_events_update_notifications()
CB Events Update Notifications
cb_events_update_notifications([mixed $data = [] ]) : mixed
Sends out an update notification when an event is updated.
Parameters
- $data : mixed = []
Tags
cb_setup_events()
CB Setup Events
cb_setup_events() : mixed
Loads our Events component to give us easy access to global values.
Tags
cb_events_format_notifications()
cb_events_format_notifications([mixed $component_action = '' ][, mixed $args = [] ]) : mixed
Parameters
- $component_action : mixed = ''
- $args : mixed = []
cb_events_notifications()
cb_events_notifications([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
cb_events_get_calendar_header()
Gets markup for the calendar header.
cb_events_get_calendar_header([string $class_prefix = '' ]) : string
Parameters
- $class_prefix : string = ''
-
The prefix to add to the calendar header.
Tags
Return values
string —The formatted header markup.
cb_events_get_calendar_view()
Outputs a calendar view of events.
cb_events_get_calendar_view() : string
Tags
Return values
string —The formatted markup.
cb_events_calendar_view()
Outputs the markup for the calendar view.
cb_events_calendar_view() : mixed
Tags
cb_events_get_list_view()
Gets the markup for the events list view.
cb_events_get_list_view([bool $is_admin = false ]) : mixed
Parameters
- $is_admin : bool = false
-
Whether the table is for an admin.
Tags
cb_events_list_view()
Outputs the markup for the events list view.
cb_events_list_view([bool $is_admin = false ]) : mixed
Parameters
- $is_admin : bool = false
-
Whether the table is for an admin.
Tags
cb_events_rewrite_rules()
Adds rewrite rules to the events component so we don't get a false 404 when we update plugins.
cb_events_rewrite_rules() : mixed
Tags
cb_events_add_query_vars()
cb_events_add_query_vars(mixed $query_vars) : mixed
Parameters
- $query_vars : mixed
cb_events_template_include()
cb_events_template_include(mixed $template) : mixed
Parameters
- $template : mixed
cb_events_get_form_module()
Returns markup for a create or update form, determined by the given string.
cb_events_get_form_module([bool $is_edit_form = false ]) : string
Parameters
- $is_edit_form : bool = false
-
Whether the form is for editing event data.
Tags
Return values
string —The form markup.
cb_events_get_new_event_module()
Gets the markup for the new events form module.
cb_events_get_new_event_module() : mixed
Tags
cb_events_new_event_module()
Outputs the markup for the new events module.
cb_events_new_event_module() : mixed
Tags
cb_events_get_edit_event_module()
Returns markup for the edit_event form module.
cb_events_get_edit_event_module() : mixed
Tags
cb_events_edit_event_module()
Outputs markup for the edit_events module.
cb_events_edit_event_module() : mixed
Tags
cb_events_admin_table_module()
Adds a table for spot bonuses to the transactions tab.
cb_events_admin_table_module() : 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_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
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_format_notifications()
cb_participation_format_notifications([mixed $component_action = '' ][, mixed $args = [] ]) : mixed
Parameters
- $component_action : mixed = ''
- $args : mixed = []
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.
cb_requests_new_request()
CB Requests Create Requests
cb_requests_new_request(array<string|int, mixed> $args) : mixed
Creates a new requests 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.
@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. @type int $applicant_id The user_id associated with the requests 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 requests was registered. @type string $date_modified A mysql datetime entry for when the requests was registered. @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 requests entry. Common statuses include "new", "approved", "denied", or "pending". @type int $request_item_id The ID of the item being requested.
}
Tags
cb_requests_new_transaction()
CB Requests New Transaction
cb_requests_new_transaction([array<string|int, mixed> $args = [] ]) : int|string
Add or subtract Confetti Bits based on request approval status.
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 $request_id A requests 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 requests entry. @type string $modified The date of the last modification for the requests entry. }
Tags
Return values
int|string —Transaction ID on success, error on failure.
cb_requests_get_amount()
Attempts to extract a predetermined value from a request item.
cb_requests_get_amount([int $request_item_id = 0 ]) : int
Parameters
- $request_item_id : int = 0
-
The ID of the request item with the request.
Tags
Return values
int —The amount we extracted.
cb_requests_get_item_name()
Gets the name of a request item.
cb_requests_get_item_name([int $request_item_id = 0 ]) : string
Parameters
- $request_item_id : int = 0
-
The ID for the request item we're checking.
Tags
Return values
string —The item name we extracted.
cb_requests_get_request_items()
Lists all available request items.
cb_requests_get_request_items([array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
There's a built-in limit of 15 items, but that can be overridden in the arguments.
Parameters
- $args : array<string|int, mixed> = []
-
{ An optional array of arguments.
@type string|array $select A comma-separated list or array of columns to get. @type int $page The page of request items. @type int $per_page How many request items should appear on each page.
}
Tags
Return values
array<string|int, mixed> —A 2D array of request items, structured like so: { [ [ 'id' => 1, 'item_name' => 'Item 1' ], [ 'id' => 2, 'item_name' => 'Item 2' ], ] }
cb_requests_get_transaction()
Gets a transaction object, if any are associated with a request.
cb_requests_get_transaction([int $transaction_id = 0 ]) : array<string|int, mixed>|bool
Use this to check if a transaction already exists for a given request.
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_requests_get_requests()
Gets an array of requests from the database.
cb_requests_get_requests([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments. @see CB_Requests_Request::get_requests() }
Tags
cb_requests_get_active_request_total()
Returns the total amount of points the user has in open requests.
cb_requests_get_active_request_total([int $user_id = 0 ]) : int
Parameters
- $user_id : int = 0
-
The ID of the user to check.
Tags
Return values
int —The total amount of points that the user has in open requests.
cb_requests_can_request()
Checks to see if a user can request the given item.
cb_requests_can_request([mixed $applicant_id = 0 ][, int $item_id = 0 ]) : bool
Parameters
- $applicant_id : mixed = 0
- $item_id : int = 0
-
The ID of the item they want
Tags
Return values
bool —True if they have enough to get the item, false otherwise.
cb_requests_can_update()
Checks to see if a user can update their request item.
cb_requests_can_update([int $applicant_id = 0 ][, int $prev_item_id = 0 ][, int $updated_item_id = 0 ]) : bool
It basically subtracts the existing item from the active request total, adds on the cost of the new item, and checks to see if the items cost more than they have to spend on requests.
Parameters
- $applicant_id : int = 0
-
The ID of the user to check.
- $prev_item_id : int = 0
-
The ID of the previous item.
- $updated_item_id : int = 0
-
The ID of the new item that they would like to change to.
Tags
Return values
bool —Whether the item would put the user over their request balance.
cb_requests_new_notifications()
Sends a notification email when a request comes in.
cb_requests_new_notifications([mixed $data = [] ]) : mixed
Parameters
- $data : mixed = []
Tags
cb_setup_requests()
CB Setup Requests
cb_setup_requests() : mixed
Sets up our requests component, so we have easy access to component globals.
Tags
cb_bits_request_sender_email_notification()
CB Bits Request Sender Email Notification
cb_bits_request_sender_email_notification([array<string|int, mixed> $args = array() ]) : mixed
This function sends an email notification to the request sender
Parameters
- $args : array<string|int, mixed> = array()
-
The arguments for the email notification.
Tags
cb_requests_new_request_notifications()
Sends out notifications whenever someone submits a new request.
cb_requests_new_request_notifications([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments passed from the CB_Requests_Request::save() method.
@see CB_Requests_Request::save()
}
Tags
cb_requests_admin_new_request_notifications()
Sends notifications to request admins after a new request is sent in.
cb_requests_admin_new_request_notifications([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments passed from the CB_Requests_Request::save() method.
@see CB_Requests_Request::save()
}
Tags
cb_requests_leadership_new_request_notifications()
Sends notifications to leadership after a new request is sent in.
cb_requests_leadership_new_request_notifications([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments passed from the CB_Requests_Request::save() method.
@see CB_Requests_Request::save()
}
Tags
cb_requests_site_admins_new_request_notifications()
Sends notifications to site admins after a new request is sent in.
cb_requests_site_admins_new_request_notifications([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments passed from the CB_Requests_Request::save() method.
@see CB_Requests_Request::save()
}
Tags
cb_requests_update_request_notifications()
Notifies a user when their request status is updated.
cb_requests_update_request_notifications([mixed $update_args = [] ]) : mixed
Parameters
- $update_args : mixed = []
Tags
cb_requests_format_notifications()
cb_requests_format_notifications([mixed $component_action = '' ][, mixed $args = [] ]) : mixed
Parameters
- $component_action : mixed = ''
- $args : mixed = []
cb_requests_nav()
CB Requests Nav
cb_requests_nav() : mixed
Outputs the requests nav.
Tags
cb_requests_format_nav_data()
CB Requests Format Nav Data
cb_requests_format_nav_data([mixed $component = '' ][, array<string|int, mixed> $items = array() ]) : array<string|int, mixed>
Formats the nav data for the requests component. 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_requests_get_nav()
CB Requests Get Nav
cb_requests_get_nav() : string
Returns the nav for the requests filtering system.
Tags
Return values
string —The nav markup.
cb_requests_admin_nav()
CB Requests Admin Nav
cb_requests_admin_nav() : mixed
Outputs the requests admin nav.
Tags
cb_requests_admin_get_nav()
CB Requests Admin Get Nav
cb_requests_admin_get_nav() : string
Returns the nav for the requests admin filtering system.
Tags
Return values
string —The nav markup.
cb_requests_get_request_items_form()
Gets markup for the request items form.
cb_requests_get_request_items_form() : string
Tags
Return values
string —The formatted markup.
cb_request_items_form()
Outputs markup for request items form.
cb_request_items_form() : mixed
Tags
cb_requests_get_requests_form()
Gets markup for the request items form.
cb_requests_get_requests_form() : string
Tags
Return values
string —The formatted markup.
cb_requests_form()
Outputs markup for request items form.
cb_requests_form() : mixed
Tags
cb_templates_get_text_input()
CB Templates Get Text Input
cb_templates_get_text_input([array<string|int, mixed> $args = [] ]) : mixed
Formats a text input that plays nice with our scripts.
Parameters
- $args : array<string|int, mixed> = []
-
A list of arguments {
Tags
cb_text_input()
CB Text Input
cb_text_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the text input.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_select_input()
CB Templates Get Select Input
cb_templates_get_select_input([array<string|int, mixed> $args = array() ]) : mixed
Creates a select input element.
Parameters
- $args : array<string|int, mixed> = array()
-
Accepts a bunch of optional arguments.
Tags
cb_templates_get_select_options()
CB Templates Get Select Options
cb_templates_get_select_options([array<string|int, mixed> $args = [] ]) : mixed
Takes care of some of the business for making select inputs.
Parameters
- $args : array<string|int, mixed> = []
-
Arguments for the select input, listed below. Required. @type string $name The name of the option. Required. @type array $options The input values, and whether they are disabled or selected. @type string $value The value for the option. Required. @type bool $disabled Whether the option is disabled or not. Optional. @type bool $selected Whether the option is selected by default. Optional.
Tags
cb_select_input()
Confetti Bits Select Input
cb_select_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the select input.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_number_input()
CB Templates Get Number Input
cb_templates_get_number_input([array<string|int, mixed> $args = [] ]) : mixed
Use this to create a number input element.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments for the input element. Details below. All settings are optional.
Tags
cb_number_input()
CB Number Input
cb_number_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the number input.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_file_input()
Confetti Bits Get File Input.
cb_templates_get_file_input([array<string|int, mixed> $args = [] ]) : mixed
Creates a file input element that accepts the specified filetypes.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments for the input element. All optional.
@type string $label The label for the input. Default 'Upload a File'. @type string $class Custom class attribute for file input. @type string $name The value used in the for attribute of the label and the name and id attributes of the input. Default 'cb_file_upload'. @type bool $required Whether or not the field is required. Default false. @type bool $multiple Whether or not the field allows multiple files. Default false. @type bool $capture Whether or not the field allows the use of a camera. Default false. @type bool $disabled Whether or not the field is disabled. Default false. @type array $accepts An array of filetypes that the input accepts. Accepts either MIME type structures or filetype structures. Should be compliant with your Wordpress configuration. Default empty.
Tags
cb_file_input()
Confetti Bits File Input
cb_file_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the file input.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_submit_input()
CB Templates Get Submit Input.
cb_templates_get_submit_input([array<string|int, mixed> $args = [] ]) : mixed
Creates a submit input element that submits a form.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments for the input element. All optional.
@type string $id The value used in the id attribute of the input. Default empty. @type value $value Value for the submit input. Default "Submit". @type bool $disabled Whether or not the field is disabled. Default false.
Tags
cb_submit_input()
CB Submit Input
cb_submit_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the submit input markup.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_hidden_input()
CB Templates Get Hidden Input
cb_templates_get_hidden_input([array<string|int, mixed> $args = [] ]) : mixed
Creates a hidden input that's either ready to receive a value or has a preset value.
Suggested utilities are getting things like user ids, logged-in usernames, emails, or empty inputs that get calculated on the page via javascript. We probably haven't written things like that yet, so you may have to set it up for your needs.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments for the input. Name, id, value, disabled, multiple.
Tags
cb_hidden_input()
CB Hidden Input
cb_hidden_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the hidden input markup.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_checkbox_input()
CB Templates Get Checkbox Input
cb_templates_get_checkbox_input([array<string|int, mixed> $args = [] ]) : mixed
Creates a checkbox input with a label and as many options as you want.
Parameters
- $args : array<string|int, mixed> = []
-
An array of options for each input you want to include, structured in a 2D array of option names => array of option parameters. {
@type string $name The value used in the for, name, and id attributes. @type string $label The label for the option. @type string $value The value of the option. @type bool $checked Whether the field is checked or not. @type bool $disabled Whether the field is disabled or not.
}
Tags
cb_checkbox_input()
CB Checkbox Input
cb_checkbox_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the checkbox input markup.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_dropzone_input()
CB Format Dropzone Input
cb_templates_get_dropzone_input([array<string|int, mixed> $args = [] ]) : mixed
Creates a hidden input and a container that can be used for drag-and-drop file uploads.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments for the input. Name, id, value, disabled, multiple, etc.
Tags
cb_dropzone_input()
CB Dropzone Input
cb_dropzone_input([array<string|int, mixed> $args = [] ]) : mixed
Outputs the hidden input markup.
Parameters
- $args : array<string|int, mixed> = []
-
The array of arguments that get passed to the getter. It would be wise to check what all is needed.
Tags
cb_templates_get_toggle_switch()
Alias for cb_templates_get_toggle_switch_input().
cb_templates_get_toggle_switch([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_toggle_switch_input()
Gets markup for a toggle switch input.
cb_templates_get_toggle_switch_input([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
-
{ An array of options for each input you want to include, structured in a 2D array of options.
@type string $name The value used in the for, name, and id attributes. @type string $label The label for the option. @type string $value The value of the option. @type bool $checked Whether the field is checked or not. @type bool $disabled Whether the field is disabled or not.
}
Tags
Return values
string —The formatted markup.
cb_toggle_switch()
CB Toggle Switch
cb_toggle_switch([array<string|int, mixed> $args = [] ]) : mixed
Outputs toggle switch markup.
Parameters
- $args : array<string|int, mixed> = []
-
An array of options for each input you want to include, structured in a 2D array of options.
@type string $name The value used in the for, name, and id attributes. @type string $label The label for the option. @type string $value The value of the option. @type bool $checked Whether the field is checked or not. @type bool $disabled Whether the field is disabled or not.
Tags
cb_templates_get_form()
CB Templates Get Form
cb_templates_get_form([mixed $args = array() ]) : string
Gets the markup for a form element.
Parameters
- $args : mixed = array()
Tags
Return values
string —The formatted markup.
cb_form()
Outputs the markup for a form element.
cb_form([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_form_module()
Gets the markup for a form module.
cb_templates_get_form_module([array<string|int, mixed> $args = [] ]) : string
Use this when you want the whole UI kit and caboodle on the Confetti Bits dashboard (i.e., you just want a form inside of a module).
Parameters
- $args : array<string|int, mixed> = []
-
{ An array of arguments.
@type string $component The name of the component. @type string $method The form method. @type array $classes Classes for the form element. @type string $action The URL for the form handler. @type string $output The markup that goes into the form. @type string $enctype The encoding for the form. @type string $autocomplete Whether the form should include autocomplete features.
}
Tags
Return values
string —The formatted markup of the form module.
cb_templates_get_form_button()
Returns formatted markup for a form button. Note that this should not be used as a submit button; we typically use input[type=submit] for that functionality. Here we'll default to button[type=button] to ensure that we can have it do what we want and not make the app have a heart attack.
cb_templates_get_form_button([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments. Accepts various attributes of button elements, with support for your own custom attributes as well. }
Tags
Return values
string —The formatted markup.
cb_form_module()
Outputs the form module's markup.
cb_form_module([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ @see cb_templates_get_form_module() }
Tags
cb_templates_get_form_output()
Dynamically populates markup and input elements for a form.
cb_templates_get_form_output([array<string|int, mixed> $args = [] ]) : mixed
When given a heading, a component, and input arguments, this function can generate an entirely unique set of markup to put into a form element. It naturally prepends the "cb_" prefix to the beginning to stick within our namespace, then supplies the value supplied by the 'component' argument, and finally appends the value defined in the input_args['name'] argument to create a (hopefully) entirely unique input element, with the given type supplied in the input_args['type'] argument. Argument... Argument... Argument. Doesn't sound like a word anymore.
Parameters
- $args : array<string|int, mixed> = []
-
{ An array of - you guessed it - arguments.
@type string $component The name for the component. Used to generate unique name and id attributes in the input elements. @type string $heading The heading to use in the output. Basically for flavor.
}
cb_templates_recursive_helper()
A recursive helper function to help us process complex content trees.
cb_templates_recursive_helper([mixed $node = [] ]) : string
It'll recurse through each node that's labeled as a 'new_node' and return a string of content that's ready to echo out into the world.
Parameters
- $node : mixed = []
Tags
Return values
string —The glorious content.
cb_templates_get_time_picker_input()
Gets markup for a time picker.
cb_templates_get_time_picker_input([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments for the time picker.
@type string $name The name attribute for the input. @type string $label The label for the input.
@type string $classes The classes for the input. @type string $value The value for the input. @type string $placeholder The placeholder for the input. @type string $min The minimum time for the input. @type string $max The maximum time for the input. @type string $step The step for the input.
}
Tags
Return values
string —The markup for the time picker input.
cb_time_picker_input()
Outputs markup for a time picker.
cb_time_picker_input([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_date_picker_input()
Gets markup for a date picker input.
cb_templates_get_date_picker_input([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments for the inputs.
@type string $label A label for the input. @type string $name The name attribute for the input. Required. @type string $placeholder A placeholder date string. Default current date, formatted 'm/d/Y'. @type string $value A preset value for the input. @type bool $disabled Whether the input should be disabled by default. Default false. @type bool $hidden Whether the input should be hidden by default. Default false. @type bool $required Whether the input should be required by default. Default false. @type string|array $classes An array of classes that will be added to the container element. Default ['cb-date-picker'].
}
Tags
Return values
string —The formatted markup for the inputs.
cb_templates_get_datetime_picker_input()
Gets markup for both date and time inputs on one line.
cb_templates_get_datetime_picker_input([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments for the inputs.
@type array $date { @see cb_templates_get_date_picker_input() } @type array $time { @see cb_templates_get_time_picker_input() }
}
Tags
Return values
string —The formatted markup for the inputs.
cb_datetime_picker()
Outputs markup for a datetime picker input.
cb_datetime_picker([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_datetime_local_input()
Formats markup for a datetime-local input.
cb_templates_get_datetime_local_input([array<string|int, mixed> $args = [] ]) : string
I cannot believe I didn't know this existed until so recently.
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of arguments.
@type string $label A label for the input. @type string $name A name for the input. @type string $placeholder A placeholder for the input. @type string $value A default value for the input. @type bool $disabled Whether the input is disabled by default. @type bool $hidden Whether the input is hidden by default. @type bool $required Whether the input is required by default. @type array $classes An array of class selectors to give the input.
}
Tags
Return values
string —The formatted markup.
cb_datetime_local_input()
Outputs markup for a datetime-local input.
cb_datetime_local_input([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_date_input()
Outputs markup for an actually nice date input. Uses Bootstrap styling and plugs in some custom data based on arguments passed.
cb_templates_get_date_input([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
{ An optional array of arguments. }
cb_date_input()
Outputs markup for a pretty date input.
cb_date_input([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
Tags
cb_templates_get_time_selector_input()
cb_templates_get_time_selector_input([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
cb_time_selector_input()
cb_time_selector_input([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
cb_templates_container()
CB Templates Container
cb_templates_container([array<string|int, mixed> $args = array() ]) : string
A function that lets us wrap content dynamically with the supplied arguments, so we can have more fun and less pain.
Parameters
- $args : array<string|int, mixed> = array()
-
An associative array of the following: { @var string $container The HTML tag to use for the container. Default 'div'. @var string $container_id The ID to use for the container. Default empty. @var array $container_classes An array of classes to use for the container. Default empty. @var string $output The content to wrap in the container. Default empty. }
Tags
Return values
string —The HTML markup to output.
cb_templates_get_button()
Formats a button element with the given arguments
cb_templates_get_button([array<string|int, mixed> $args = array() ]) : string
Parameters
- $args : array<string|int, mixed> = array()
-
{ @var string $id The ID of the button @var string $content The content of the button @var string $type The type of the button (button, reset, submit). Default 'button' @var array $classes An array of classes to add to the button. Default array('cb-button') }
Tags
Return values
string —The formatted button element
cb_templates_get_list_item()
Formats a list item element with the given arguments
cb_templates_get_list_item([array<string|int, mixed> $args = array() ]) : string
Parameters
- $args : array<string|int, mixed> = array()
-
{ @var string $id The ID of the item @var string $content The content of the item @var array $classes An array of classes to add to the button. Default array('cb-button') }
Tags
Return values
string —The formatted button element
cb_templates_get_link()
CB Templates Get Link
cb_templates_get_link([array<string|int, mixed> $args = array() ]) : string
Returns a formatted anchor tag.
Parameters
- $args : array<string|int, mixed> = array()
-
An array of options. { @type array $classes An array of classes to add to the element. @type string $href The href for the element. Default '#'. @type string $id The id for the element. @type string $content The text content of the element. @type array $custom_attr An array of custom data attributes for the element. }
Tags
Return values
string —The formatted anchor markup.
cb_templates_get_table()
cb_templates_get_table([mixed $component = '' ][, mixed $heading = '' ][, mixed $paginated = true ]) : mixed
Parameters
- $component : mixed = ''
- $heading : mixed = ''
- $paginated : mixed = true
cb_templates_get_ajax_table()
CB Templates AJAX Table
cb_templates_get_ajax_table([mixed $component = '' ][, mixed $heading = '' ][, mixed $paginated = true ]) : string|void
Returns a table for the specified component. Typically used for displaying items from the database that are fetched via AJAX. Optionally, a pagination bar can be displayed above and below the table.
Parameters
- $component : mixed = ''
- $heading : mixed = ''
- $paginated : mixed = true
Tags
Return values
string|void —The HTML for the table or nothing if the component is empty.
cb_templates_ajax_table()
Outputs markup for an AJAX table.
cb_templates_ajax_table([string $component = '' ][, string $heading = '' ][, bool $paginated = true ]) : mixed
Parameters
- $component : string = ''
-
The component that gets used in a pile of CSS selectors.
- $heading : string = ''
-
A heading to use for the module. Default empty.
- $paginated : bool = true
-
Whether the table should be paginated.
Tags
cb_templates_get_pagination()
CB Get Pagination
cb_templates_get_pagination([string $component = '' ]) : string|void
Returns a pagination bar for the specified component. Typically used when displaying items from the database that are fetched via AJAX.
Parameters
- $component : string = ''
-
The component to display the pagination bar for.
Tags
Return values
string|void —The HTML for the pagination bar or nothing if the component is empty.
cb_templates_get_heading()
Formats the markup for a heading element.
cb_templates_get_heading([string $content = '' ][, int $level = 4 ]) : string
Parameters
- $content : string = ''
-
The content for the heading element. Default empty.
- $level : int = 4
-
The level for the heading element. Default 4.
Tags
Return values
string —the formatted heading.
cb_templates_heading()
CB Templates Heading
cb_templates_heading([string $content = '' ][, int $level = 4 ]) : mixed
Output the markup for a heading element.
Parameters
- $content : string = ''
-
The content for the heading element. Default empty.
- $level : int = 4
-
The level for the heading element. Default 4.
Tags
cb_templates_get_nav_items()
CB Templates Get Nav Items
cb_templates_get_nav_items([string $component = '' ][, array<string|int, mixed> $items = array() ]) : string
Returns a list of dynamically populated nav items as a string.
Parameters
- $component : string = ''
-
The component whose nav we need to make.
- $items : array<string|int, mixed> = array()
-
A 2D array of items to put into the nav. { @type array $label The label that will be used in the markup acts as a key for the nav item options { @type bool $active Adds an "active" class onto the list item if true. @type array $custom_attr An optional array of key => value pairs. @type string $href An href for the anchor element that will go inside the list item. } }
Tags
Return values
string —The markup of all the collective nav items.
cb_templates_get_nav()
CB Templates Get Nav
cb_templates_get_nav([string $component = '' ][, array<string|int, mixed> $items = array() ]) : string
Returns a dynamically populated nav as a string.
Parameters
- $component : string = ''
-
The component whose nav we need to make.
- $items : array<string|int, mixed> = array()
-
A 2D array of items to put into the nav. { @type array $label The label that will be used in the markup acts as a key for the nav item options { @type bool $active Adds an "active" class onto the list item if true. @type array $custom_attr An optional array of key => value pairs. @type string $href An href for the anchor element that will go inside the list item. } }
Tags
Return values
string —The nav markup.
cb_transactions_get_history_for_user()
CB Transactions Get History for User
cb_transactions_get_history_for_user([mixed $user_id = 0 ][, mixed $export_type = '' ]) : mixed
Handles the logic behind getting the right data from the database.
Parameters
- $user_id : mixed = 0
- $export_type : mixed = ''
Tags
cb_csv_send_headers()
CB CSV Send Headers
cb_csv_send_headers([mixed $file_name = '' ]) : mixed
Manually alters headers to allow for us to modify how a csv reaches an end user, and to ensure safe passage for our noble data wizards.
Parameters
- $file_name : mixed = ''
Tags
cb_generate_csv()
CB Generate CSV
cb_generate_csv([array<string|int, mixed> $user_transactions = array() ][, string $export_type = '' ]) : mixed
Responsible for generating csv files for users that request an export of their data.
Parameters
- $user_transactions : array<string|int, mixed> = array()
-
A 2D array of transactions
- $export_type : string = ''
-
The type of export the user requested.
Tags
cb_export()
CB Export
cb_export() : mixed
Checks to see if export parameters are set on a POST request, exports transactions from the database based on parameters.
Tags
cb_activity_bits()
CB Activity Bits
cb_activity_bits(string $content, int $user_id, int $activity_id) : mixed
This hooks onto the BP Activity Posted Update action to give someone Confetti Bits when they post an update.
Parameters
- $content : string
-
The content of the activity post.
- $user_id : int
-
The id of the user associated with the activity post.
- $activity_id : int
-
The id of the activity post.
Tags
cb_transactions_get_total_sent_today()
CB Transactions Get Total Sent Today
cb_transactions_get_total_sent_today() : int
This function gets the total number of Confetti Bits that have been sent for the current day.
Tags
Return values
int —$total The total number of Confetti Bits sent for the current day.
cb_transactions_get_request_balance()
CB Transactions Get Request Balance
cb_transactions_get_request_balance([int $user_id = 0 ]) : int
Get the balance available to a user for the current spending cycle. The request balance resets 1 month after users are done earning for the year.
So the balance that is returned is a calculation based on the following timeline:
- When the earning cycle starts, the available balance for requests is accrued for one year. They may then spend those for an additional month after that.
- date_sent >= $cb->earn_start, date_sent <= earn_end, amount > 0
- date_sent >= $cb->earn_start, date_sent <= spend_end, amount < 0
Parameters
- $user_id : int = 0
-
The ID for the user whose balance we want.
Tags
Return values
int —The calculated balance available for requests.
cb_transactions_get_transfer_balance()
CB Transactions Get Transfer Balance
cb_transactions_get_transfer_balance([int $user_id = 0 ]) : int
Get the balance available to a user for the current earning cycle.
Parameters
- $user_id : int = 0
-
The ID for the user whose balance we want.
Tags
Return values
int —The calculated balance available for transfers.
cb_transactions_check_activity_bits()
CB Transactions Check Activity Bits
cb_transactions_check_activity_bits([int $user_id = 0 ]) : mixed
Checks to see if there were any days throughout the cycle where the user might have posted on the BuddyBoss activity feed, and didn't receive any points for it. Helps cover our tail if we accidentally push some breaking changes or do something silly with how activity bits are registered.
Parameters
- $user_id : int = 0
-
The ID for the user we want to check.
Tags
cb_transactions_get_activity_posts()
CB Transactions Get Activity Posts
cb_transactions_get_activity_posts([int $user_id = 0 ]) : array<string|int, mixed>
Returns an array of activity posts for the given user. Uses BuddyBoss's global value for the activities table name.
Parameters
- $user_id : int = 0
-
The ID of the user whose posts we want.
Tags
Return values
array<string|int, mixed> —An array of activity posts, if any.
cb_transactions_get_activity_transactions()
CB Transactions Get Activity Transactions
cb_transactions_get_activity_transactions([int $user_id = 0 ]) : array<string|int, mixed>
Retrieves a list of all transactions from the current earning cycle that were registered by a user posting on the BuddyBoss activity feed.
Parameters
- $user_id : int = 0
-
The user's ID. Default current user ID.
Tags
Return values
array<string|int, mixed> —An array of transactions, if there are any.
cb_transactions_calculate_activity_bits()
CB Transactions Calculate Activity Bits
cb_transactions_calculate_activity_bits([array<string|int, mixed> $activities = array() ][, array<string|int, mixed> $transactions = array() ]) : array<string|int, mixed>
Calculates how many points a user should receive according to the number of unaccounted for activity posts they've sent out, that don't have an accompanying Confetti Bits transaction on that same day.
Parameters
- $activities : array<string|int, mixed> = array()
-
An array of activity posts
- $transactions : array<string|int, mixed> = array()
-
An array of transactions
Tags
Return values
array<string|int, mixed> —An array of activity posts that are missing an accompanying transaction on a given day.
cb_transactions_has_bits()
CB Transactions Has Bits
cb_transactions_has_bits([string $action = '' ]) : bool
Checks whether the user has gotten Confetti Bits for a specific action this year.
Parameters
- $action : string = ''
-
The action to check the database for. Usually either "birthday" or "anniversary".
Tags
Return values
bool —Whether we found an entry for the given action within the past year.
cb_transactions_birthday_bits()
CB Transactions Birthday Bits
cb_transactions_birthday_bits() : mixed
Gives the user Confetti Bits on their birthday.
Tags
cb_transactions_anniversary_bits()
CB Transactions Anniversary Bits
cb_transactions_anniversary_bits() : mixed
Gives the user Confetti Bits on their anniversary.
Tags
cb_transactions_get_amount_from_anniversary()
CB Transactions Get Amount From Anniversary
cb_transactions_get_amount_from_anniversary(DateTime $date) : int
Parameters
- $date : DateTime
Tags
Return values
int —The transaction amount appropriate for the anniversary date
cb_transactions_get_leaderboard()
CB Transactions Get Leaderboard
cb_transactions_get_leaderboard([mixed $limit = true ][, mixed $previous = false ]) : array<string|int, mixed>
Queries the database for the top 15 users by Confetti Bits balance Also includes the current user if they aren't in the top 15
Parameters
- $limit : mixed = true
- $previous : mixed = false
Tags
Return values
array<string|int, mixed> —$results The top 15 users by Confetti Bits balance, or the top 15 users by Confetti Bits balance with the current user included
cb_transactions_delete_transaction()
CB Transactions Delete Transaction
cb_transactions_delete_transaction([array<string|int, mixed> $args = [] ]) : int
Delete a transaction from the database. Do this at your own risk, you cannot undo this action.
Parameters
- $args : array<string|int, mixed> = []
-
{ An associative array of keys and values to check the database for. Accepts any property of a CB_Transactions_Transaction object. Example: ['recipient_id' => 5, 'component_action' => 'cb_activity_bits'] Passing the above will delete all transactions where the recipient_id is 5, and the component_action is cb_activity_bits. }
Tags
Return values
int —The number of rows affected. @see $wpdb::delete()
cb_transactions_new_transaction()
CB Transactions New Transaction
cb_transactions_new_transaction([array<string|int, mixed> $args = [] ]) : mixed
Manages sending bits between users. Yikes.
Parameters
- $args : array<string|int, mixed> = []
-
An array of arguments that get merged into a set of default values. {
@var int $item_id The item ID associated with the transaction. Used with BuddyBoss's Notifications API to help format some dynamic information in the notifications. We use the sender_id for this.
@var int $secondary_item_id The secondary item ID associated with the transaction. Used with BuddyBoss's Notifications API to help format some dynamic information in the notifications. We use the recipient_id for this.
@var int $sender_id The ID of the user sending the bits.
@var int $recipient_id The ID of the user recieving the bits.
@var datetime $date_sent The date and time of the transaction.
@var string $log_entry A note that usually references the purpose for the transaction.
@TODO: Make log entries optional?
@var string $component_name The name associated with the component that is sending the bits. Used with BuddyBoss's Notifications API. This will almost always just be 'confetti_bits'.
@var string $component_action The action associated with the transaction. We use this to differentiate transaction types to easily categorize them and run calculations. It is also used with BuddyBoss's Notifications API to send certain notifications that are associated with certain actions. }
Tags
cb_transactions_remove_bits()
CB Transactions Remove Bits
cb_transactions_remove_bits(mixed $id, mixed $reassign, mixed $user) : mixed
This is hooked into the delete_user action, so that transactions get deleted whenever a user is.
Parameters
- $id : mixed
- $reassign : mixed
- $user : mixed
Tags
cb_transactions_new_events_transaction()
A supplemental helper function that will let us process event-based transactions without modifying existing API stuff too much.
cb_transactions_new_events_transaction([array<string|int, mixed> $args = [] ]) : int|bool|string
We'll likely add more robust error handling later on. It's just getting down to the wire and we gotta push this out ASAP.
Parameters
- $args : array<string|int, mixed> = []
-
{ An array of arguments. All required.
@type int $event_id The ID of the event object. @type int $recipient_id The ID of the recipient user.
}
Tags
Return values
int|bool|string —Transaction ID on full success, false if something is missing, an error message if something when wrong.
cb_transactions_new_contests_transaction()
A supplemental helper function that will let us process contest-based transactions without modifying existing API stuff too much.
cb_transactions_new_contests_transaction([array<string|int, mixed> $args = [] ]) : int|bool|string
We'll likely add more robust error handling later on. It's just getting down to the wire and we gotta push this out ASAP.
Parameters
- $args : array<string|int, mixed> = []
-
{ An array of arguments. All required.
@type int $event_id The ID of the event object. @type int $recipient_id The ID of the recipient user.
}
Tags
Return values
int|bool|string —Transaction ID on full success, false if something is missing, an error message if something when wrong.
cb_import_bits()
CB Import Bits
cb_import_bits([mixed $args = [] ]) : mixed
This is going to allow an admin user to bulk import Confetti Bits transactions from a CSV file.
Parameters
- $args : mixed = []
Tags
cb_importer()
Confetti Bits Importer
cb_importer() : mixed
This is going to allow an admin user to bulk import a whole list of Confetti Bits transactions using PHP's built-in csv parser. We've included a lot of sanitization and error-handling here, but it could always be improved upon.
Some explanatory comments throughout, but the gist is: Make sure it's a post request, on the confetti bits page, from the import panel Get the wp importer Set the redirect path so we can P-R-G after it's finished, Set some variables to display after the import Set where the files go Open the filestream Start the import process Read each line, validate each field Make sure nothing insane is going into our database Compile the feedback and shove it into a session token Redirect Get the messages, kick back and enjoy
Tags
cb_import_bda()
CB Import BDA
cb_import_bda([mixed $args = '' ]) : mixed
This is going to allow an admin user to bulk import birthdays and anniversaries from a CSV file.
Parameters
- $args : mixed = ''
Tags
cb_bda_importer()
CB BDA Importer
cb_bda_importer() : mixed
This is going to allow an admin user to bulk import a whole list of birthdays and anniversaries using PHP's built-in csv parser.
Some explanatory comments throughout, but the gist is: Make sure it's a post request, on the confetti bits page, from the import panel Get the wp importer Set the redirect path so we can P-R-G after it's finished, Set some variables to display after the import Set where the files go Open the filestream Start the import process Read each line, validate each field Make sure nothing insane is going into our database Compile the feedback and shove it into a session token Redirect Get the messages, kick back and enjoy
Tags
cb_setup_transactions()
CB Setup Transactions
cb_setup_transactions() : mixed
Sets up our transactions component, so we have easy access to component globals.
Tags
cb_groups_activity_notifications()
Sends a notification to members of a group when someone posts.
cb_groups_activity_notifications(string $content, int $user_id, int $group_id, int $activity_id) : mixed
Parameters
- $content : string
-
The notification content.
- $user_id : int
-
The ID of the user who is posting in the group.
- $group_id : int
-
The group ID.
- $activity_id : int
-
The ID of the activity post.
Tags
cb_transactions_notifications()
Sends transaction notifications based on component action.
cb_transactions_notifications([array<string|int, mixed> $data = [] ]) : int|bool
Parameters
- $data : array<string|int, mixed> = []
-
{ An associative array of data received from the CB_Transactions_Transaction::save() method.
@see CB_Transactions_Transaction::save().
}
Tags
Return values
int|bool —Notification ID on success, false on failure.
cb_transactions_format_notifications()
cb_transactions_format_notifications([mixed $component_action = '' ][, mixed $args = [] ]) : mixed
Parameters
- $component_action : mixed = ''
- $args : mixed = []
cb_groups_format_notifications()
cb_groups_format_notifications(mixed $component_action[, mixed $args = [] ]) : mixed
Parameters
- $component_action : mixed
- $args : mixed = []
cb_transactions_spot_bonus_notifications()
cb_transactions_spot_bonus_notifications([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
cb_transactions_volunteer_bits_notifications()
cb_transactions_volunteer_bits_notifications([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
cb_transactions_get_total_sent_today_notice()
Gets the total number of Confetti Bits that have been sent for the current day and returns a notice to the user.
cb_transactions_get_total_sent_today_notice() : string
Tags
Return values
string —$notice The notice to be displayed to the user.
cb_transactions_total_sent_today_notice()
Output the total number of Confetti Bits that the user has sent for the current day.
cb_transactions_total_sent_today_notice() : mixed
Tags
cb_transactions_request_balance()
Display the users request balance.
cb_transactions_request_balance([int $user_id = 0 ]) : mixed
Parameters
- $user_id : int = 0
-
The user ID.
Tags
cb_transactions_get_request_balance_notice()
Get the users request balance notice.
cb_transactions_get_request_balance_notice([int $user_id = 0 ]) : string
Parameters
- $user_id : int = 0
-
The user ID.
Tags
Return values
string —The users request balance notice.
cb_transactions_request_balance_notice()
Output the users request balance notice.
cb_transactions_request_balance_notice() : mixed
Tags
cb_transactions_get_balances_notice()
CB Transactions Balances Notice
cb_transactions_get_balances_notice([int $user_id = 0 ]) : string
Assemble the markup for both the user's transfer balance and their request balance.
Parameters
- $user_id : int = 0
-
The id of the user whose balance notice we're assembling. Defaults to current logged-in user.
Tags
Return values
string —$notice the formatted notice markup.
cb_transactions_balances_notice()
CB Transactions Balances Notice
cb_transactions_balances_notice() : mixed
Display the users balances above the dashboard.
Tags
cb_transactions_get_transfer_balance_notice()
CB Transactions Get Transfer Balance Notice
cb_transactions_get_transfer_balance_notice([int $user_id = 0 ]) : string
Assemble the transfer balance markup for the user's transfer balance notice.
Parameters
- $user_id : int = 0
-
The id of the user whose balance notice we're assembling. Defaults to current logged-in user.
Tags
Return values
string —$notice the formatted notice markup.
cb_transactions_get_balance_notice()
Dynamically gets the markup for the balance notice at the top of the dashboard.
cb_transactions_get_balance_notice([string $type = '' ][, int $user_id = 0 ]) : string
Parameters
- $type : string = ''
-
The type of balance notice to return.
- $user_id : int = 0
-
The ID for the user whose balance we're retrieving.
Tags
Return values
string —The markup for the balance notice.
cb_transactions_balance_notice()
Outputs a balance notice of the given type, for the given user.
cb_transactions_balance_notice([mixed $type = '' ][, mixed $user_id = 0 ]) : mixed
Parameters
- $type : mixed = ''
- $user_id : mixed = 0
Tags
cb_transactions_transfer_balance_notice()
CB Transactions Transfer Balance Notice
cb_transactions_transfer_balance_notice() : mixed
Output markup that shows a user's transfer balance.
Tags
cb_transactions_get_request_selection()
CB Transactions Get Request Selection
cb_transactions_get_request_selection() : string
Get markup for the Request Selection Input
Tags
Return values
string —The formatted select input.
cb_transactions_request_selection()
Outputs markup for the request selector.
cb_transactions_request_selection() : mixed
Tags
cb_transactions_get_leaderboard_module()
Returns container markup with transactions leaderboard content inside.
cb_transactions_get_leaderboard_module() : string
Tags
Return values
string —The formatted markup
cb_transactions_leaderboard_module()
Outputs the markup for the Confetti Bits leaderboard module.
cb_transactions_leaderboard_module() : mixed
Tags
cb_transactions_get_send_bits_module()
Gets the containerized markup for the send bits module on the Confetti Bits dashboard.
cb_transactions_get_send_bits_module() : string
Tags
Return values
string —The formatted markup.
cb_transactions_send_bits_module()
Outputs the markup for the send bits module.
cb_transactions_send_bits_module() : mixed
Tags
cb_transactions_get_formatted_leaderboard()
Returns a string of markup that contains listings for the top 15 users with the most Confetti Bits.
cb_transactions_get_formatted_leaderboard() : string
Tags
Return values
string —The formatted markup.
cb_transactions_leaderboard()
Outputs markup for the transactions leaderboard.
cb_transactions_leaderboard() : mixed
Tags
cb_transactions_get_import_bda_module()
Formats the markup for the "Import Birthdays" module.
cb_transactions_get_import_bda_module() : string
Uses a bunch of our new templating structure to clean up some of the excess markup lying around here.
Tags
Return values
string —The formatted markup.
cb_import_bda_module()
Outputs the "Import B-Days & Anniversaries" markup.
cb_import_bda_module() : mixed
Tags
cb_transactions_get_spot_bonus_module()
cb_transactions_get_spot_bonus_module() : mixed
cb_transactions_get_volunteers_module()
cb_transactions_get_volunteers_module() : mixed
cb_transactions_spot_bonus_table_module()
Adds a table for spot bonuses to the transactions tab.
cb_transactions_spot_bonus_table_module() : mixed
Tags
cb_transactions_spot_bonus_module()
Adds the spot bonus form to the transactions tab.
cb_transactions_spot_bonus_module() : mixed
Tags
cb_transactions_volunteer_hours_module()
cb_transactions_volunteer_hours_module() : mixed
Confetti_Bits()
The main function responsible for returning the one true Confetti_Bits
Confetti_Bits() : Confetti_Bits
Tags
Return values
Confetti_Bitscb_install_bb_platform_notice()
Display notice if BuddyBoss Platform is not installed.
cb_install_bb_platform_notice() : mixed
cb_update_bb_platform_notice()
Display notice if BuddyBoss Platform is not updated.
cb_update_bb_platform_notice() : mixed
cb_bp_is_active()
Check if Confetti Bits is active.
cb_bp_is_active() : mixed
cb_plugin_init()
Init the plugin.
cb_plugin_init() : void
Tags
cb_is_get_request()
CB Is Get Request
cb_is_get_request() : bool
Checks if the current request is a GET request
Tags
Return values
bool —True if GET request, false otherwise
cb_is_post_request()
CB Is Post Request
cb_is_post_request() : bool
Checks if the current request is a POST request
Tags
Return values
bool —True if POST request, false otherwise
cb_is_patch_request()
CB Is Patch Request
cb_is_patch_request() : bool
Checks if the current request is a PATCH request
Tags
Return values
bool —True if PATCH request, false otherwise
cb_is_delete_request()
CB Is Delete Request
cb_is_delete_request() : bool
Checks if the current request is a DELETE request
Tags
Return values
bool —True if DELETE request, false otherwise
confetti_bits_admin_enqueue_script()
confetti_bits_admin_enqueue_script() : mixed
cb_core_notifications_init()
Initializes our notifications class.
cb_core_notifications_init() : mixed
So we can get those sweet, sweet noties.
Tags
cb_user_birthday_anniversary_fields()
Returns form markup that allows privileged users to manually input the birthday and anniversary dates for other users.
cb_user_birthday_anniversary_fields(mixed $user) : mixed
Parameters
- $user : mixed
Tags
cb_save_user_birthday_anniversary_fields()
cb_save_user_birthday_anniversary_fields(mixed $user_id, mixed $notify) : mixed
Parameters
- $user_id : mixed
- $notify : mixed
cb_core_set_reset_date_globals()
CB Core Set Reset Date Globals
cb_core_set_reset_date_globals() : mixed
Sets a few internal globals using the DateTimeImmutable class so that we can reference these spending/earning cycles throughout the app without running these calculations all the time.
A breakdown of what this does:
-
There are two cycles: an earning cycle and a spending cycle
-
The reset date refers to the earning cycle. That is when users start over with a zero'd out bank of confetti bits. So the earning cycle "ends" on the reset date.
-
The earning cycle "starts" one year prior to that, on the same date. Please don't set it to February 29th, I did not account for that when I built this forsaken system.
-
The spending cycle is offset by 1 month after the earning cycle. So the spending cycle "ends" 1 month after the earning cycle does. That means that the spending cycle "starts" one month after the earning cycle does as well.
-
There are situations where a user may want to look back at a previous cycle, so we account for those here as well. We only need the dates that those cycles started, because they ended when the current cycles started.
Tags
cb_core_set_spot_bonus_global()
Sets the amount for spot bonuses in our core class for easy access.
cb_core_set_spot_bonus_global() : mixed
Make sure to set this value in the DB via admin settings, or else we may never experience the bliss of automation.
Tags
cb_core_auto_reset()
Automatically increments the reset date by 1 year.
cb_core_auto_reset() : mixed
Tags
cb_core_current_date()
CB Core Current Date
cb_core_current_date([bool $offset = false ][, string $format = "Y-m-d H:i:s" ]) : string
Returns the current date and time in the given format. Defaults to MySQL format in the site's timezone.
Parameters
- $offset : bool = false
-
Whether to use the site's UTC offset setting. Default true.
- $format : string = "Y-m-d H:i:s"
-
The desired datetime format. Default MySQL - 'Y-m-d H:i:s'
Tags
Return values
string —The formatted datetime.
str_starts_with()
Str Starts With
str_starts_with([string $haystack = '' ][, string $needle = '' ]) : bool
PHP 8 Polyfill for str_starts_with
Parameters
- $haystack : string = ''
-
The string to search.
- $needle : string = ''
-
The substring to search for at the beginning.
Tags
Return values
bool —Whether the string starts with the given substring.
str_ends_with()
Str Ends With
str_ends_with(string $haystack, string $needle) : bool
PHP 8 Polyfill for str_ends_with
Parameters
- $haystack : string
-
The string to search.
- $needle : string
-
The substring to search for at the end.
Tags
Return values
bool —Whether the string ends with the given substring.
str_contains()
Str Contains
str_contains(string $haystack, string $needle) : bool
PHP 8 Polyfill for str_contains
Parameters
- $haystack : string
-
The string to search.
- $needle : string
-
The substring to search for.
Tags
Return values
bool —Whether the string contains the given substring.
cb_flush_rewrite_rules()
CB Flush Rewrite Rules
cb_flush_rewrite_rules() : mixed
Flushes the rewrite rules after we update a plugin or theme, so our pages stop disappearing.
Tags
cb_get_patch_data()
Gets PATCH data from an HTTP PATCH request.
cb_get_patch_data() : array<string|int, mixed>
Retrieves data from a PATCH request and returns it as an associative array.
Tags
Return values
array<string|int, mixed> —The PATCH request body as an associative array.
cb_get_delete_data()
Gets DELETE data from an HTTP DELETE request.
cb_get_delete_data() : array<string|int, mixed>
Retrieves data from a DELETE request and returns it as an associative array.
Tags
Return values
array<string|int, mixed> —The DELETE request body as an associative array.
cb_core_get_missing_users()
Gets a list of transactions for nonexistent users.
cb_core_get_missing_users() : array<string|int, mixed>
Get a list of users that are present in the confetti_bits_transactions table, but not in the wp_users table. Returns an array of transactions where the sender or recipient isn't on the platform anymore.
Tags
Return values
array<string|int, mixed> —An associative array of transaction data.
cb_core_get_user_display_name()
Gets the user display name.
cb_core_get_user_display_name([int $user_id = 0 ]) : string
Attempts to get a display_name for the given user_id. If that comes up empty, searches for the first_name. If that also comes up empty, searches for the nickname. If there's no display name to be found, it gives us a lovely bunch of abject nothingness.
Parameters
- $user_id : int = 0
-
The ID for the user whose name we want. Default current user_id.
Tags
Return values
string —The display_name on success, empty on failure.
cb_core_get_user_email()
Returns the email address for the given user.
cb_core_get_user_email([int $user_id = 0 ]) : string
Parameters
- $user_id : int = 0
-
The ID of the user. Default current user.
Tags
Return values
string —The user's email address, if one exists.
cb_core_is_multi_array()
Checks if the parameter is a multi-dimensional array.
cb_core_is_multi_array(array<string|int, mixed> $arr) : bool
Parameters
- $arr : array<string|int, mixed>
-
The array to check.
Tags
Return values
bool —Whether the array is multi-dimensional.
cb_core_send_sitewide_notice()
Sends out a sitewide notice.
cb_core_send_sitewide_notice() : mixed
Use this to send out non-critical updates that are intended to be informative or nice to know, such as an upcoming or recent update, new feature, etc.
Tags
cb_core_get_doomsday_clock()
Returns the number of days remaining until the reset date.
cb_core_get_doomsday_clock() : int
Tags
Return values
int —The number of days remaining before the reset.
cb_core_sanitize_string()
Washes away the sins of bad actors.
cb_core_sanitize_string([string $input = '' ]) : string
Use this to aggressively scrub input strings. I doubt that there are going to be any elite hackers playing injecting nonsense into this app, but this is good practice for other kinds of sanitization that we might want to do later.
Parameters
- $input : string = ''
-
An input string
Tags
Return values
string —A kinder, gentler string.
cb_core_smtp_init()
Injects our own config settings into PHPMailer.
cb_core_smtp_init(PHPMailer $phpmailer) : mixed
Parameters
- $phpmailer : PHPMailer
-
A PHPMailer object.
Tags
cb_core_admin_menu()
Adds a menu item for our settings.
cb_core_admin_menu() : mixed
Tags
cb_templates_get_admin_page()
Formats markup for our admin settings page.
cb_templates_get_admin_page() : string
Tags
Return values
string —The formatted page markup.
cb_core_admin_page()
Outputs markup for our admin settings page.
cb_core_admin_page() : mixed
Tags
cb_core_admin_settings_init()
cb_core_admin_settings_init() : mixed
cb_core_admin_settings_sanitize()
Will eventually be used to sanitize user input in the admin menu.
cb_core_admin_settings_sanitize(mixed $input) : string
Parameters
- $input : mixed
-
The input passed via post.
Tags
Return values
string —$input The "sanitized" input.
cb_core_admin_settings_section_callback()
Returns the content for our main settings section.
cb_core_admin_settings_section_callback() : string
Tags
Return values
string —Content.
cb_core_admin_reset_date_setting()
Outputs the setting field for the reset date.
cb_core_admin_reset_date_setting() : mixed
Tags
cb_core_admin_volunteer_setting()
Outputs the setting field for the volunteer amount per hour.
cb_core_admin_volunteer_setting() : mixed
Tags
cb_core_admin_spot_bonus_setting()
Outputs the setting field for the volunteer amount per hour.
cb_core_admin_spot_bonus_setting() : mixed
Tags
cb_core_convert_scripts_to_modules()
Replaces our default script tags with modules.
cb_core_convert_scripts_to_modules(mixed $tag, mixed $handle, mixed $src) : mixed
Parameters
- $tag : mixed
- $handle : mixed
- $src : mixed
cb_core_delete_user_data()
Deletes all Confetti Bits data associated with deleted user.
cb_core_delete_user_data(int $id, int $reassign, WP_User $user) : mixed
Parameters
- $id : int
-
The ID of the user that's being deleted.
- $reassign : int
-
An optional user ID to reassign items to.
- $user : WP_User
-
The instance of WP_User associated with the deleted user.
Tags
cb_core_do_spot_bonuses()
cb_core_do_spot_bonuses() : mixed
cb_core_listify()
cb_core_listify(mixed $string) : mixed
Parameters
- $string : mixed
cb_core_schedule_events()
cb_core_schedule_events() : mixed
cb_core_utc_to_local()
cb_core_utc_to_local([mixed $date_string = '' ]) : mixed
Parameters
- $date_string : mixed = ''
cb_core_ordinal_suffix()
Adds an ordinal suffix to a given integer.
cb_core_ordinal_suffix(int|string $int) : string
Parameters
- $int : int|string
-
An integer.
Tags
Return values
string —The same integer, but with a little spice.