BuddyDev

Search

[Resolved] BuddyPress Group Type Generator

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

    Hi Brajesh,

    Do you have a “BuddyPress Group Type Generator” by BuddyDev in the pipeline?

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #25962

    Hi Has,
    We did develop a plugin for it but the end result was not flexible enough for public release. We will like to update that and release it sometime in future.

    Regards
    Brajesh

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

    Hi Brajesh,

    Now that a lot of companies and organisations worldwide are trying at least to test Holacracy, it could really be a good idea to have that plugin in your portfolio…

    «Holacracy is a new way of structuring and running your organization that replaces the conventional management hierarchy. Instead of operating top-down, power is distributed throughout the organization – giving individuals and teams freedom while staying aligned to the organization’s purpose.»
    https://www.holacracy.org/explore/why-practice-holacracy

    …while using BuddyPress in a professional environment I would say to have Group Types is a basic feature.

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #26027

    Hi Hans,
    Thank you. We do plan to take another look at it sometimes in the future.

    Regards
    Brajesh

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

    Hi Brajesh,
    I really need your help with this: on that new site we have two types of groups, only two.

    Groups for Villages and Coworking Groups

    That’s it. Only site admin can create groups. That way only in backend we need a radio button for these two group types.

    In the frontend there should be an additional tab for Villages and a tab for Coworking Groups in /groups/ – that’s it.

    Can you provide the code to do it, please.

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #26151

    Hi Hans,
    You may use code like this to register the group types

    
    add_action( 'bp_groups_register_group_types', function () {
    
    	bp_groups_register_group_type(
    		'school',
    		array(
    			'labels'                => array(
    				'name'          => 'Schools',
    				'singular_name' => 'School',
    			),
    			'has_directory'         => true,
    			'show_in_create_screen' => true,
    			//'show_in_list'          => null,
    			'description'           => '',
    			'create_screen_checked' => false, // keep it checked?
    		)
    	);
    	bp_groups_register_group_type(
    		'college',
    		array(
    			'labels'                => array(
    				'name'          => 'Colleges',
    				'singular_name' => 'College',
    			),
    			'has_directory'         => true,
    			'show_in_create_screen' => true,
    			//'show_in_list'          => null,
    			'description'           => '',
    			'create_screen_checked' => false, // keep it checked?
    		)
    	);
    }
    );
    

    Change school/college with Villages/Co working

    If the theme supports, The tabs will appear on group directory.

    Regards
    Brajesh

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

    Hi Brajesh,
    Many thanks for your support.

    The checkboxes appear in the group settings backend, but I’ve got no tabs in the frontend! I’m using plain bp-nouveau…

    Does bp-nouveau not support group types in the frontend?

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #26160

    Hi Hans,
    You will need to add the following to your tem,plate’s buddypress/groups/index.php

    
    	<?php if ( function_exists( 'bp_groups_get_group_types' ) ) :?>
    		<?php $group_types = bp_groups_get_group_types( array(), 'objects' ); ?>
    		<?php foreach ( $group_types as $group_type => $details ) : ?>
    			<li id="groups-type<?php echo $group_type; ?>">
    				<a href="<?php bp_group_type_directory_permalink( $group_type ); ?>"><?php echo $details->labels['name']; ?></a>
    			</li>
    		<?php endforeach; ?>
    	<?php endif; ?>
    

    Regards
    Brajesh

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

    Hi Brajesh,
    Thanks for the code. It’s working but result are two additional text links for Villages and for Coworking.

    Is it not possible to include the two group types in .groups-type-navs (in the tabs)?

    Regards,
    Hans

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #26178

    Hi Hans,
    The code is from our legacy based template. It works as nav tabs. I do not use nouveau currently, Will need a few days before I can check it on nouveau.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved