/**
 * Output an excerpt of the group description.
 *
 * @param object $group Optional. The group being referenced. Defaults to the
 *        group currently being iterated on in the groups loop.
 */
function bp_group_description_excerpt($group = false)
{
    echo bp_get_group_description_excerpt($group);
}
Пример #2
0
function bp_group_description_excerpt()
{
    echo bp_get_group_description_excerpt();
}
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        $parent_id = isset($bp->groups->current_group->id) ? $bp->groups->current_group->id : 0;
        echo $before_widget;
        echo $before_title;
        if ($parent_id == 0) {
            echo $instance['title'];
        } else {
            echo $instance['sub_title'];
        }
        echo $after_title;
        ?>
		<?php 
        if (!class_exists('BP_Groups_Group')) {
            _e('You must enable Groups component to use this widget.', 'bp-group-hierarchy');
            return;
        }
        ?>
		<?php 
        if (bp_has_groups_hierarchy('type=' . $instance['sort_type'] . '&per_page=' . $instance['max_groups'] . '&max=' . $instance['max_groups'] . '&parent_id=' . $parent_id)) {
            ?>

			<ul id="toplevel-groups-list" class="item-list">
				<?php 
            while (bp_groups()) {
                bp_the_group();
                ?>
					<li>
						<div class="item-avatar">
							<a href="<?php 
                bp_group_permalink();
                ?>
"><?php 
                bp_group_avatar_thumb();
                ?>
</a>
						</div>

						<div class="item">
							<div class="item-title"><a href="<?php 
                bp_group_permalink();
                ?>
" title="<?php 
                echo strip_tags(bp_get_group_description_excerpt());
                ?>
"><?php 
                bp_group_name();
                ?>
</a></div>
							<div class="item-meta"><span class="activity">
								<?php 
                switch ($instance['sort_type']) {
                    case 'newest':
                        printf(__('created %s', 'buddypress'), bp_get_group_date_created());
                        break;
                    case 'alphabetical':
                    case 'active':
                        printf(__('active %s', 'buddypress'), bp_get_group_last_active());
                        break;
                    case 'popular':
                        bp_group_member_count();
                        break;
                    case 'prolific':
                        printf(_n('%d member group', '%d member groups', bp_group_hierarchy_has_subgroups(), 'bp-group-hierarchy'), bp_group_hierarchy_has_subgroups());
                }
                ?>
							</span></div>
							<?php 
                if ($instance['show_desc']) {
                    ?>
							<div class="item-desc"><?php 
                    bp_group_description_excerpt();
                    ?>
</div>
							<?php 
                }
                ?>
						</div>
					</li>

				<?php 
            }
            ?>
			</ul>
			<?php 
            wp_nonce_field('groups_widget_groups_list', '_wpnonce-groups');
            ?>
			<input type="hidden" name="toplevel_groups_widget_max" id="toplevel_groups_widget_max" value="<?php 
            echo esc_attr($instance['max_groups']);
            ?>
" />

		<?php 
        } else {
            ?>

			<div class="widget-error">
				<?php 
            _e('There are no groups to display.', 'buddypress');
            ?>
			</div>

		<?php 
        }
        ?>

		<?php 
        echo $after_widget;
        ?>
		<?php 
    }
Пример #4
0
    function on_bp_gtm_admin_groups($bp_gtm)
    {
        global $bp;
        ?>
        <table id="bp-gtm-admin-table" class="widefat link-group">
            <thead>
                <tr class="header">
                    <td colspan="2"><?php 
        _e('Which groups should have GTM System turned on?', 'bp_gtm');
        ?>
</td>
                    <td class="own_roles"><?php 
        _e('Own roles?', 'bp_gtm');
        ?>
</td>
                </tr>
            </thead>
            <tbody id="the-list">
                <tr>
                    <td><input type="checkbox" class="bp_gtm_allgroups" name="bp_gtm_allgroups" <?php 
        echo 'all' == $bp_gtm['groups'] ? 'checked="checked" ' : '';
        ?>
 value="all" /></td>
                    <td><?php 
        _e('All groups', 'bp_gtm');
        ?>
</td>
                    <td class="own_roles">&nbsp;</td>
                </tr>
                <?php 
        $arg['type'] = 'alphabetical';
        $arg['per_page'] = '1000';
        if (bp_has_groups($arg)) {
            while (bp_groups()) {
                bp_the_group();
                $description = preg_replace(array('<<p>>', '<</p>>', '<<br />>', '<<br>>'), '', bp_get_group_description_excerpt());
                echo '<tr>
                                <td><input name="bp_gtm_groups[' . bp_get_group_id() . ']" class="bp_gtm_groups" type="checkbox" ' . ('all' == $bp_gtm['groups'] || $bp_gtm['groups'][bp_get_group_id()] == 'on' ? 'checked="checked" ' : '') . 'value="on" /></td>
                                <td><a href="' . bp_get_group_permalink() . $bp->gtm->slug . '/" target="_blank">' . bp_get_group_name() . '</a> &rarr; ' . $description . '</td>
                                <td class="own_roles"><input name="bp_gtm_groups_own_roles[' . bp_get_group_id() . ']" class="bp_gtm_groups_own_roles" type="checkbox" ' . ((!empty($bp_gtm['groups_own_roles']) || !empty($bp_gtm['groups_own_roles'][bp_get_group_id()])) && 'all' == $bp_gtm['groups_own_roles'] || !empty($bp_gtm['groups_own_roles'][bp_get_group_id()]) && $bp_gtm['groups_own_roles'][bp_get_group_id()] == bp_get_group_id() ? 'checked="checked" ' : '') . 'value="' . bp_get_group_id() . '" /></td>
                            </tr>';
            }
        }
        ?>
            </tbody>
            <tfoot>
                <tr class="header">
                    <td><input type="checkbox" class="bp_gtm_allgroups" name="bp_gtm_allgroups" <?php 
        echo 'all' == $bp_gtm['groups'] ? 'checked="checked" ' : '';
        ?>
 value="all" /></td>
                    <td><?php 
        _e('All groups', 'bp_gtm');
        ?>
</td>
                    <td>&nbsp;</td>
                </tr>
            </tfoot>
        </table>
        <?php 
    }
function bp_group_description_excerpt($deprecated = false)
{
    echo bp_get_group_description_excerpt();
}