Last active
October 16, 2020 16:29
-
-
Save kadimi/3d951be119f2e92f9f16e5a27c8ffcf0 to your computer and use it in GitHub Desktop.
Custom slug for the SportsPress tab on a BuddyPress profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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