Skip to content

Instantly share code, notes, and snippets.

@rakeshkumar125
Created July 30, 2017 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rakeshkumar125/c3e5e94f71f4cac7ef8f5704316047a1 to your computer and use it in GitHub Desktop.
Save rakeshkumar125/c3e5e94f71f4cac7ef8f5704316047a1 to your computer and use it in GitHub Desktop.
BuddyPress add new tab
/**
Plugin Name: BuddyPress add new tab
Description: Test case for a bug. When using the Admin subnav, select "Test" and "Test 2" will disappear
Version: 0.6
Author: Rakesh Kumar
**/
function bptt_init() {
class Groups_Test_Tab extends BP_Group_Extension {
var $visibility = 'public'; // 'public' will show your extension to non-group members, 'private' means you have to be a member of the group to view your extension.
var $enable_create_step = false; // If your extension does not need a creation step, set this to false
var $enable_nav_item = true; // If your extension does not need a navigation item, set this to false
var $enable_edit_item = true; // If your extension does not need an edit screen, set this to false
function Groups_Test_Tab() {
$this->name = "Test";
$this->slug = "test";
$this->create_step_position = 21;
$this->nav_item_position = 31;
}
function display() {
echo "test";
}
function edit_screen() {
echo "test";
}
}
class Groups_Test_Tab2 extends BP_Group_Extension {
var $visibility = 'public'; // 'public' will show your extension to non-group members, 'private' means you have to be a member of the group to view your extension.
var $enable_create_step = false; // If your extension does not need a creation step, set this to false
var $enable_nav_item = true; // If your extension does not need a navigation item, set this to false
var $enable_edit_item = true; // If your extension does not need an edit screen, set this to false
function Groups_Test_Tab2() {
$this->name = "Test 2";
$this->slug = "test2";
$this->create_step_position = 22;
$this->nav_item_position = 32;
}
function display() {
echo "test 2";
}
function edit_screen() {
echo "Test 2";
}
}
class Groups_Test_Tab3 extends BP_Group_Extension {
var $visibility = 'public'; // 'public' will show your extension to non-group members, 'private' means you have to be a member of the group to view your extension.
var $enable_create_step = false; // If your extension does not need a creation step, set this to false
var $enable_nav_item = true; // If your extension does not need a navigation item, set this to false
var $enable_edit_item = true; // If your extension does not need an edit screen, set this to false
function Groups_Test_Tab3() {
$this->name = "Test 3";
$this->slug = "test3";
$this->create_step_position = 23;
$this->nav_item_position = 33;
}
function display() {
echo "test 3";
}
function edit_screen() {
echo "Test 3";
}
}
bp_register_group_extension( 'Groups_Test_Tab' );
bp_register_group_extension( 'Groups_Test_Tab2' );
bp_register_group_extension( 'Groups_Test_Tab3' );
}
add_action( 'bp_include', 'bptt_init' );
?>
$this->create_step_position = 22;
$this->nav_item_position = 32;
}
function display() {
echo "test 3";
}
function edit_screen() {
echo "Test 3";
}
}
bp_register_group_extension( 'Groups_Test_Tab' );
bp_register_group_extension( 'Groups_Test_Tab2' );
bp_register_group_extension( 'Groups_Test_Tab3' );
}
add_action( 'bp_include', 'bptt_init' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment