Skip to content

Instantly share code, notes, and snippets.

@kadimi
Last active October 16, 2020 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadimi/3d951be119f2e92f9f16e5a27c8ffcf0 to your computer and use it in GitHub Desktop.
Save kadimi/3d951be119f2e92f9f16e5a27c8ffcf0 to your computer and use it in GitHub Desktop.
Custom slug for the SportsPress tab on a BuddyPress profile
<?php
/**
* Change this line.
*/
define( 'Custom_BP_SprotsPress_Tab_Slug', 'change-this' );
/**
* Do not change below this line.
*/
add_action( 'init', function() {
remove_action( 'bp_loaded', 'bp_sportspress_setup_component' );
add_action( 'bp_loaded', function() {
global $bp;
$bp->sportspress = new Class extends BP_SportsPress_Component {
public function __construct() {
global $bp;
$this->params = array(
'adminbar_myaccount_order' => apply_filters( 'bp_sp_events_nav_position', 61 )
);
parent::start(
defined( 'Custom_BP_SprotsPress_Tab_Slug' ) ? constant( 'Custom_BP_SprotsPress_Tab_Slug' ) : 'sportspress',
__( 'sportspress', 'bp-sportspress' ),
constant( 'BP_SPORTSPRESS_DIR' ) . '/_inc',
$this->params
);
$this->includes();
$this->setup_hooks();
$bp->active_components[$this->id] = '1';
}
};
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment