BuddyDev

Search

[Resolved] BuddyPress Group Type Generator

  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26180

    Hi Brajesh,
    Thanks for your reply. Yes, please do that.

    Only Tabs, but very important for my presentation with people from these Villages!

    Regards,
    Hans

  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26204

    Hi Brajesh,
    You already have it in BuddyPress Member Types Pro – I mean the way to create the tabs within nouveau… 😉
    …over there it’s working perfect.

    Waiting for you…
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #26217

    Hi Hans,
    Please use this code in your bp-custom.php

    
    
    add_filter( 'bp_nouveau_get_groups_directory_nav_items', function ( $nav_items ) {
    
    	$group_types = bp_groups_get_group_types( array(), 'objects' );
    	$pos         = 25;
    	foreach ( $group_types as $group_type => $details ) {
    		if ( ! $details->has_directory ) {
    			continue;
    		}
    		$nav_items[ 'group-type-' . $group_type ] = array(
    			'component' => 'groups',
    			'slug'      => 'group-type-' . $group_type,
    			'li_class'  => array( 'no-ajax', 'group-type-' . $group_type ),
    			'link'      => bp_get_group_type_directory_permalink( $group_type ),
    			'text'      => $details->labels['name'],
    			'count'     => false,
    			'position'  => $pos,
    		);
    		$pos + 10;
    	}
    
    	return $nav_items;
    } );
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26218

    Hi Brajesh,
    Working perfect. Many thanks!

    One last request: would you please add the count bubbles for these additional groups?!?

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #26219

    Hi Hans,
    Thank you.

    I intentionally did not add the count as it is not efficient for group types (There is no direct function to get count).

    I will suggest avoiding the count for now.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26220

    Hi Brajesh,
    Got it. I’m very happy with your support. Thank you!

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #26221

    Thank you Hans.
    All the best with the presentation 🙂

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved