<?php 
    foreach ($group_types as $type) {
        ?>
			<div class="checkbox">
				<label for="<?php 
        printf('group-type-%s', $type->name);
        ?>
">
					<input type="checkbox" name="group-types[]" id="<?php 
        printf('group-type-%s', $type->name);
        ?>
" value="<?php 
        echo esc_attr($type->name);
        ?>
" <?php 
        checked(bp_groups_has_group_type(bp_get_current_group_id(), $type->name));
        ?>
/> <?php 
        echo esc_html($type->labels['name']);
        ?>
					<?php 
        if (!empty($type->description)) {
            printf(__('&ndash; %s', 'buddypress'), '<span class="bp-group-type-desc">' . esc_html($type->description) . '</span>');
        }
        ?>
				</label>
			</div>

		<?php 
    }
    ?>
Esempio n. 2
0
 public function test_groups_has_type_should_return_true_on_success()
 {
     $g = $this->factory->group->create(array('creator_id' => self::$u1));
     bp_groups_register_group_type('foo');
     bp_groups_register_group_type('bar');
     bp_groups_set_group_type($g, 'foo');
     bp_groups_set_group_type($g, 'bar', true);
     $this->assertTrue(bp_groups_has_group_type($g, 'foo'));
     $this->assertEqualSets(array('bar', 'foo'), bp_groups_get_group_type($g, false));
 }