class Players extends Kernowdev\Clanbite\Extensions\SkeletonExtension: Players.
This extension adds player functionality, including player profiles and settings.
class
- Full name
Kernowdev\Clanbite\Extensions\Players- Extends
Kernowdev\Clanbite\Extensions\Skeleton
Constants
| Name | Value | Description |
|---|---|---|
PLAYER_PROFILE_HEADER_TEMPLATE_PART_SLUG | 'clanbite-player-profile-header' | Slug for the virtual wp_template_part resolved from templates/players/parts/player-profile-header.html. |
Methods
__construct()Sets up our extension loader.ajax_save_player_settings()Ajax: save player settings.create_player_profile_header_template_part_object()Builds the virtual template part from templates/players/parts/player-profile-header.html.do_account_info_fields()Render the first/last name fields (and the read-only email and profile URL) on the Account Info settings panel.do_profile_avatar_fields()Render the avatar and cover upload fields on the Profile Info settings panel.do_profile_info_fields()Render the display name, tagline, bio, website, country, city and birthday fields on the Profile Info settings panel.do_social_networks_fields()Renders Profile → Social Networks fields on the front-end player settings screen.enable_profiles()Enable player profile functionality.enqueue_scripts()Register and localize CLANBITEPLAYERSETTINGS when self::should_enqueue_player_settings_frontend_assets() allows it.filter_get_block_templates_include_player_profile_header()Lists the virtual player profile header with other template parts (Site Editor, inserter).filter_pre_get_block_file_template_player_profile_header()Resolves the shared player profile header as a theme-scoped template part for core/template-part.filter_render_block_context_social_on_player_profile()Supplies clanbite/playerId to Social Kit blocks on player-profile routes.filter_request_for_players_virtual_routes()Recover /players/ directory query vars when rewrite rules are stale.get_canonical_request_path()Request path after the home URL path (no leading/trailing slashes).get_player_profile_header_template_part()Returns a cached \WP_Block_Template for the player profile header markup file.get_profile_templates()Get FSE templates owned by the Players extension.get_resolved_player_settings_route()Resolve nav/panel slugs from query vars to registered settings sections.get_setting()Read a Players setting from clanbite_players_settings.get_settings_admin(){@inheritDoc}hydrate_main_query_as_player_profile()Force the main query to an author archive for a resolved player (shared 404 + stolen-query recovery).maybe_canonicalize_player_profile_subpage()Redirect invalid or inaccessible player subpages to the profile root.maybe_canonicalize_player_settings_url()Redirect single-segment settings URLs to /players/settings/{nav}/{first-panel}/.maybe_fix_players_directory_404()If /players/ was still a 404, recover before templates load.maybe_fix_players_profile_404()If /players/{nicename}/ is still 404, recover before templates load (rewrite / query conflict edge cases).maybe_load_player_profile_template()Prefer the Clanbite player profile template for player author archives.maybe_load_player_settings_template()Load the player settings template when players_settings is set; guests are sent to the login screen.maybe_load_player_subpage_template()Load a dedicated template for registered player subpages (e.g. player-notifications.php).maybe_load_players_directory_template()Load the plugin players directory template (FSE or classic).maybe_normalize_player_profile_stolen_query()When a hierarchical Page (or other singular) steals /players/{nicename}/, fix flags before the template loader.maybe_redirect_author_archives_to_players()Send /author/{nicename}/ and plain ?author= archives to /players/{nicename}/.modify_author_links()Point author links at the canonical /players/{nicename} URL.parse_query_for_players_directory()Normalize main query flags for the virtual players directory.player_subpage_has_dedicated_template()Whether a registered player subpage has a dedicated front template (player-{slug}.php).posts_pre_query_players_directory()Skip SQL for the players directory virtual route.pre_get_posts_force_player_author_archive()Force the main query to treat /players/{nicename}/ as an author archive when a page/CPT stole early parsing.prefer_plugin_player_subpage_block_template()Prefer the plugin player-{subpage} block template when resolving that slug on a matching author sub-route.prefer_plugin_players_directory_block_template()Prefer the plugin players-directory block template when resolving that slug (e.g. Site Editor preview).prefer_plugin_players_player_profile_block_template()Prefer the plugin players-player-profile block template when resolving that slug (matches register_block_template id).register_account_nav_items()Add the Account sub-items to the player settings navigation.register_image_sizes()Register the cover and avatar image sizes used by player profiles.register_player_settings_nav_items()Add the core Profile and Account sections to the player settings navigation.register_players_directory_shortcode()Register shortcode used by the players directory block template.register_profile_blocks()Register the Players blocks from build/players and hook the front-end script enqueue.register_profile_endpoints()register_profile_nav_items()Add the Profile sub-items (profile info, social networks) to the player settings navigation.register_profile_query_vars()Register the query vars used by player settings and profile sub-pages.register_profile_templates()Register the Players FSE templates (see self::get_profile_templates()).register_user_meta_keys()Register Players user meta (avatar, cover and profile fields) for REST and sanitization.render_players_directory_shortcode()Renders a simple paginated list of users linked to /players/{nicename}/.run_installer(){@inheritDoc}run_uninstaller(){@inheritDoc}run_updater(){@inheritDoc}run(){@inheritDoc}save_player_account_info_settings()Save the Account Info panel (first and last name).save_player_profile_settings()Save the Profile Info panel (avatar, cover and profile fields).scrub_main_query_conflicting_vars_for_player_routes()Clear query vars that would resolve to a singular post/page instead of a player author archive.set_plugin_block_template_id_for_site_editor()Point the Site Editor admin-bar link at Clanbite plugin templates, not the theme fallback (e.g. Archive).setup_extension()Setup and validate extension values.should_enqueue_player_settings_frontend_assets()Whether to print CLANBITEPLAYERSETTINGS for this front request.should_use_player_profile_template()Whether the front request should use the default player profile block template (overview).strip_conflicting_query_vars_for_players_virtual_routes()Remove query vars that would resolve to a post/page and conflict with virtual player routes.
Defined in inc/extensions/players/class-extension-players.php