Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Custom Tab to Groups Directory

Viewing 3 replies - 1 through 3 (of 3 total)
  • I also just discovered this 🙁

    I looked at the code for the plugin ‘Events Manager’, and managed to put together the following which worked for me:

        function setup_group_nav(){
        	global $bp;	
        	/* Add some group subnav items */
        	$user_access = false;
        	$group_link = '';
        	if( bp_is_active('groups') && !empty($bp->groups->current_group) ){
        		$group_link = $bp->root_domain . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug . '/';
        		$user_access = $bp->groups->current_group->user_has_access;
        		bp_core_new_subnav_item( array( 
        			'name' => __( 'Custom', 'custom'),
        			'slug' => 'custom', 
        			'parent_url' => $group_link, 
        			'parent_slug' => $bp->groups->current_group->slug,
        			'screen_function' => 'bp_group_custom', 
        			'position' => 50, 
        			'user_has_access' => $user_access, 
        			'item_css_id' => 'custom' 
        		));
        	}
        }
        add_action( 'bp_init', 'setup_group_nav' );
        
        function bp_group_custom() {
        	add_action('bp_template_title', 'my_new_group_show_screen_title');
        	add_action('bp_template_content', 'my_new_group_show_screen_content');
        	
        	$templates = array('groups/single/plugins.php', 'plugin-template.php');
        	if (strstr(locate_template($templates), 'groups/single/plugins.php')) {
        		bp_core_load_template(apply_filters('bp_core_template_plugin', 'groups/single/plugins'));
        	} else {
        		bp_core_load_template(apply_filters('bp_core_template_plugin', 'plugin-template'));
        	}
        	
        }
        	
        function my_new_group_show_screen_title() {
        	echo 'New Tab Title';
        }
        	
        function my_new_group_show_screen_content() {
        	echo 'New tab page content';
        	
        }
    

    Diabolique
    Participant

    @diabolique

    Unfortunately it’s not working in my case

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar