class Teams extends Kernowdev\Clanbite\Extensions\SkeletonExtension skeleton.
This skeleton outlines the requirements for an extension for the Clanbite plugin. All extensions will need to extend this class.
class
- Full name
Kernowdev\Clanbite\Extensions\Teams- Extends
Kernowdev\Clanbite\Extensions\Skeleton
Constants
| Name | Value | Description |
|---|---|---|
POST_TYPE | 'clanbite_team' | Team post type slug. |
TEAM_ROLE_ADMIN | 'admin' | |
TEAM_ROLE_EDITOR | 'editor' | |
TEAM_ROLE_MEMBER | 'member' | |
TEAM_ROLE_BANNED | 'banned' | |
TEAM_PROFILE_HEADER_TEMPLATE_PART_SLUG | 'clanbite-team-profile-header' | Slug for the virtual wp_template_part resolved from templates/teams/parts/team-profile-header.html. |
Methods
__construct()Sets up our extension loader.add_team_events_meta_box()Meta box: per-team events toggle (requires global events enabled).ajax_save_team_media()Ajax: save team avatar and/or cover from front-end blocks (multipart POST).ajax_team_invite_search()Ajax search endpoint for invite-able users.allows_multiple_team_memberships()Global setting: players may belong to more than one team.can_ban_players()Check if banning players is enabled for a team.can_edit_team_frontend()Check if team can be edited from front-end.can_invite_players()Check if invites are enabled for a team.can_user_join_team()Check whether a user can join a team based on join mode.cleanup_team_membership_index_for_team_deletion()Remove this team from every affected user’s membership index (call after the team post is deleted).create_team_profile_header_template_part_object()Builds the virtual template part from templates/teams/parts/team-profile-header.html.enqueue_team_editor_assets()Enqueue block editor assets for team options panel.events_extension_is_active()Whether the Events extension is enabled so team event routes and templates should resolve.filter_get_block_templates_include_team_profile_header()Lists the virtual team profile header with other template parts (Site Editor, inserter).filter_pre_get_block_file_template_team_profile_header()Resolves the shared team profile header as a theme-scoped template part for core/template-part.filter_request_for_team_virtual_pages()Force team virtual query vars from the URL when rewrite rules did not match (flush/order issues).filter_team_create_form_block_args()Hide the team create form from the block inserter when directory mode is off.filter_team_singular_block_context()Pass the current team post into block context on singular templates (nested blocks often lack postId on the front end).get_canonical_request_path()Request path after the home URL path (no leading/trailing slashes).get_current_url()Current request URL for redirects.get_default_team_manage_form_sections()Default section definitions for the front-end team manage form.get_setting()Get a teams extension setting value.get_settings_admin(){@inheritDoc}get_team_action_url()Front-end URL for a team action (e.g. manage): /teams/{slug}/{action}/.get_team_create_url()Public URL for the create-team screen.get_team_data_store()Team data store instance (swappable).get_team_description_for_form()Plain text for the description textarea.get_team_front_action_rewrite_slugs()Action slugs that receive a dedicated teams/{slug}/{action}/ rewrite rule.get_team_front_action_slugs_for_rewrites()Action slugs used for teams/{slug}/{action}/ rewrite registration (may omit events when the Events extension is off).get_team_join_modes()Get allowed team join modes.get_team_manage_form_sections()Sections for the front-end team manage form (filterable).get_team_manage_tab_descriptions()Short tab descriptions for the manage form (keyed by section id).get_team_manage_url()Front-end manage URL for a team.get_team_member_count()Number of roster members (excluding banned by default).get_team_member_role()Role for a user on a team, or null if not on roster (and not author).get_team_member_roles_map()Map of user ID => role for a team (author defaults to admin when missing from meta).get_team_mode()Get current teams mode.get_team_options()Get per-team option state.get_team_post_type_labels()Labels for the cp_team post type (admin list, editor chrome, admin bar, REST).get_team_profile_header_template_part()Returns a cached \WP_Block_Template for the team profile header markup file.get_team_profile_url_for_slug()Public profile URL for a team slug (cp_team permalink, or fallback from the registered rewrite slug).get_team_templates()Get all FSE templates owned by the Teams extension.get_team()Hydrate a Team from storage.get_user_ids_for_team_membership_cleanup()Collect user IDs that still reference this team in their membership index (while the team post exists).get_user_managed_team_ids()Published teams the user may manage on the front end (admin or editor roster role, or site teams admin).get_user_team_membership_count()Count team associations for a user (default: teams they author).handle_create_team()Handle front-end team creation post request.handle_delete_team_nopriv()Logged-out delete handler.handle_delete_team()Permanently delete a team from the front-end manage form.handle_notification_actions()Handle notification actions for team-related notifications.handle_save_team_manage_nopriv()Logged-out save handler.handle_save_team_manage()Save team from front-end manage form.initialize_team_roster()Initial roster after team creation.integrate_team_preferences()Register user meta and (when Players profiles are on) player settings UI for team invites.is_multiple_teams_mode()Whether teams mode is "multiple_teams".is_single_team_mode()Whether teams mode is "single_team".is_team_directories_mode()Whether teams mode is "team_directories".map_team_front_edit_meta_cap()Let team admins/editors update cp_team from the front-end manage form.maybe_block_banned_team_access()Block banned members from viewing the team on the front end.maybe_enqueue_team_manage_form_assets()Enqueue styles and the Interactivity module for the tabbed team manage screen.maybe_fix_team_create_route_404()If core still marked /teams/create as 404, recover before templates load (rewrite flush / ordering edge cases). Does not depend on team directory mode; create is always available when Teams is enabled.maybe_fix_team_events_route_404()If core still marked /teams/{slug}/events/ as 404, recover before templates load (rewrite flush / ordering edge cases).maybe_handle_team_media_upload()Handle optional media upload for team create flow.maybe_load_team_virtual_templates()Load virtual team templates (create / manage).maybe_redirect_disallowed_team_virtual_actions()When an extension disables its team profile subpage, redirect virtual URLs to the public team profile.maybe_remove_team_manage_image()Remove a team avatar or cover attachment and meta (manage form).maybe_single_team_template()Load the team block template on classic themes (block markup is not in post_content).parse_query_for_team_virtual_pages()Stop the main query from behaving as the blog / front page for team virtual routes.persist_team_roles_map()Persist roster and sync per-user membership index for invite limits.posts_pre_query_team_virtual_pages()Skip SQL for team virtual routes so the main loop is empty.prefer_plugin_single_clanbite_team_block_template()Use the plugin Single Team block template when the theme also defines single-clanbite_team (often Post Content only).prime_clanbite_team_single_loop_for_plugin_template()Plugin block templates never call the_post(); prime the main query so team blocks and get_the_ID() work on the front end.redirect_after_team_create()Redirect helper for create team flow.register_cp_team_meta_key()Register one cp_team meta key with a consistent auth callback for REST.register_team_blocks()Register all blocks owned by the Teams extension.register_team_front_routes()Front routes (BuddyPress-style: component / item / action).register_team_image_sizes()Register intermediate sizes for team avatars (mapped from Teams settings presets).register_team_meta()Register team option meta keys.register_team_post_type()Register team post type used by team modes.register_team_query_vars()register_team_templates()Register all FSE templates owned by the Teams extension.register_teams_player_settings_nav()register_teams_player_settings_sub_nav()remove_team_from_user_membership_index()render_frontend_team_manage()Render the front-end team manage UI (included from template).render_player_team_preferences_panel()Front-end player settings: team invite preference.render_team_events_meta_box()Output the team events meta box.render_team_manage_block()Server render for team manage FSE template (block templates do not run PHP from file content).render_team_manage_delete_form()Separate form to delete the team (cannot nest inside the main save/upload form).render_team_manage_section_media()Team avatar and cover image uploads (same field names as the create-team flow).render_team_manage_section_profile()Team profile fields (name, code, motto, description, country, record).render_team_manage_section_roster()Roster table (team admins only).render_team_manage_section_team_options()Membership and team flags (join mode, invites, editing, bans, match challenges).reserve_team_route_slugs()Avoid team slugs that collide with the top-level /teams/create/ route.rest_prepare_clanbite_team_merge_meta()Ensure team meta in REST responses includes all registered keys (helps block editor hydration).run_installer(){@inheritDoc}run_uninstaller(){@inheritDoc}run_updater(){@inheritDoc}run(){@inheritDoc}sanitize_team_country_input()Validate a country code against the Players country list.sanitize_team_join_mode()Sanitize team join mode.sanitize_team_member_role()Sanitize a team member role slug.save_player_team_preferences()Persist team invite preference from player settings save.save_team_events_meta_box()Save the team events meta box.send_team_invite()Send a team invite notification to a user.set_plugin_block_template_id_for_site_editor()Point the Site Editor admin-bar link at Clanbite team templates instead of the theme fallback.setup_extension()Setup and validate extension values.strip_conflicting_query_vars_for_team_virtual_routes()Remove query vars that would resolve to a post/page and conflict with virtual team routes.sync_default_team_rosters_on_user_register()Add the user to configured default team rosters after registration.sync_default_team_rosters_on_wp_login()Re-apply default team rosters on login so existing accounts pick up newly configured teams.sync_membership_index_for_user_team()sync_team_meta_after_front_end_create()Re-write team meta after front-end create so DB + REST match the submitted wizard (and uploads).team_manage_form_has_image_upload()Whether the manage form submitted a new image file for a field.team_meta_auth_callback()Allow reading/updating registered team meta when the user can edit the team post.update_team_options()Update per-team options.user_accepts_team_invites()Whether the user accepts unsolicited team invites (player setting).user_at_team_membership_limit()Whether the user already has the maximum teams allowed by global settings.user_can_appear_in_team_invite_search()Whether a user should appear in team invite autocomplete / pending lists.user_can_delete_team_on_frontend()Whether the user may permanently delete the team from the front-end manage screen.user_can_manage_team_on_frontend()Whether the user may open the front-end manage screen (admin or editor, not banned).user_is_team_admin_on_frontend()Whether the user is a team admin on the front end.user_is_teams_site_admin()Whether the user bypasses roster-based team permissions (site admin or multisite super admin).
Defined in inc/extensions/teams/class-extension-teams.php
Changelog
| Version | Description |
|---|---|
| 1.3.0 | Updated. |