Ejemplo n.º 1
0
				<div class="update_count">
					<?php 
        global $wpdb;
        $group_id = bp_get_group_id();
        $update_count = $wpdb->get_var("SELECT COUNT(*) FROM wp_bp_activity WHERE item_id={$group_id}");
        echo $update_count;
        ?>
				</div>
			</div>
		</div>
	</div>
	<?php 
        if (false) {
            ?>
		<li <?php 
            bp_group_class();
            ?>
>
			<div class="item-avatar">
				<a href="<?php 
            bp_group_permalink();
            ?>
"><?php 
            bp_group_avatar('type=thumb&width=72&height=72');
            ?>
</a>
			</div>

			<div class="item">
				<div class="item-title"><a href="<?php 
            bp_group_permalink();
Ejemplo n.º 2
0
    function widget($args, $instance)
    {
        $user_id = apply_filters('bp_group_widget_user_id', '0');
        extract($args);
        if (empty($instance['group_default'])) {
            $instance['group_default'] = 'popular';
        }
        if (empty($instance['title'])) {
            $instance['title'] = __('Groups', 'buddypress');
        }
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        $title = !empty($instance['link_title']) ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '">' . $title . '</a>' : $title;
        echo $before_title . $title . $after_title;
        $group_args = array('user_id' => $user_id, 'type' => $instance['group_default'], 'per_page' => $instance['max_groups'], 'max' => $instance['max_groups']);
        ?>

		<?php 
        if (bp_has_groups($group_args)) {
            ?>
			<div class="item-options" id="groups-list-options">
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="newest-groups"<?php 
            if ($instance['group_default'] == 'newest') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Newest", 'buddypress');
            ?>
</a> |
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="recently-active-groups"<?php 
            if ($instance['group_default'] == 'active') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Active", 'buddypress');
            ?>
</a> |
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="popular-groups" <?php 
            if ($instance['group_default'] == 'popular') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Popular", 'buddypress');
            ?>
</a>
			</div>

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

						<div class="item">
							<div class="item-title"><a href="<?php 
                bp_group_permalink();
                ?>
" title="<?php 
                bp_group_name();
                ?>
"><?php 
                bp_group_name();
                ?>
</a></div>
							<div class="item-meta">
								<span class="activity">
								<?php 
                if ('newest' == $instance['group_default']) {
                    printf(__('created %s', 'buddypress'), bp_get_group_date_created());
                }
                if ('active' == $instance['group_default']) {
                    printf(__('active %s', 'buddypress'), bp_get_group_last_active());
                } elseif ('popular' == $instance['group_default']) {
                    bp_group_member_count();
                }
                ?>
								</span>
							</div>
						</div>
					</li>

				<?php 
            }
            ?>
			</ul>
			<?php 
            wp_nonce_field('groups_widget_groups_list', '_wpnonce-groups');
            ?>
			<input type="hidden" name="groups_widget_max" id="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 
    }
    /**
     * Extends our frontend output method.
     *
     * @param array $args     Array of arguments for the widget.
     * @param array $instance Widget instance data.
     */
    public function widget($args, $instance)
    {
        /**
         * Filters the user ID to use with the widget instance.
         *
         * @since 1.5.0
         *
         * @param string $value Empty user ID.
         */
        $user_id = apply_filters('bp_group_widget_user_id', '0');
        extract($args);
        if (empty($instance['group_default'])) {
            $instance['group_default'] = 'popular';
        }
        if (empty($instance['title'])) {
            $instance['title'] = __('Groups', 'buddypress');
        }
        /**
         * Filters the title of the Groups widget.
         *
         * @since 1.8.0
         * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
         *
         * @param string $title    The widget title.
         * @param array  $instance The settings for the particular instance of the widget.
         * @param string $id_base  Root ID for all widgets of this type.
         */
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        /**
         * Filters the separator of the group widget links.
         *
         * @since 2.4.0
         *
         * @param string $separator Separator string. Default '|'.
         */
        $separator = apply_filters('bp_groups_widget_separator', '|');
        echo $before_widget;
        $title = !empty($instance['link_title']) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
        echo $before_title . $title . $after_title;
        $max_groups = !empty($instance['max_groups']) ? (int) $instance['max_groups'] : 5;
        $group_args = array('user_id' => $user_id, 'type' => $instance['group_default'], 'per_page' => $max_groups, 'max' => $max_groups);
        ?>

		<?php 
        if (bp_has_groups($group_args)) {
            ?>
			<div class="item-options" id="groups-list-options">
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="newest-groups"<?php 
            if ($instance['group_default'] == 'newest') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Newest", 'buddypress');
            ?>
</a>
				<span class="bp-separator" role="separator"><?php 
            echo esc_html($separator);
            ?>
</span>
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="recently-active-groups"<?php 
            if ($instance['group_default'] == 'active') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Active", 'buddypress');
            ?>
</a>
				<span class="bp-separator" role="separator"><?php 
            echo esc_html($separator);
            ?>
</span>
				<a href="<?php 
            bp_groups_directory_permalink();
            ?>
" id="popular-groups" <?php 
            if ($instance['group_default'] == 'popular') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Popular", 'buddypress');
            ?>
</a>
			</div>

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

						<div class="item">
							<div class="item-title"><a href="<?php 
                bp_group_permalink();
                ?>
" title="<?php 
                bp_group_name();
                ?>
"><?php 
                bp_group_name();
                ?>
</a></div>
							<div class="item-meta">
								<span class="activity">
								<?php 
                if ('newest' == $instance['group_default']) {
                    printf(__('created %s', 'buddypress'), bp_get_group_date_created());
                } elseif ('active' == $instance['group_default']) {
                    printf(__('active %s', 'buddypress'), bp_get_group_last_active());
                } elseif ('popular' == $instance['group_default']) {
                    bp_group_member_count();
                }
                ?>
								</span>
							</div>
						</div>
					</li>

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

		<?php 
        } else {
            ?>

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

		<?php 
        }
        ?>

		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
Ejemplo n.º 4
0
	</div>

	<?php 
    do_action('bp_before_directory_groups_list');
    ?>

	<ul id="groups-list" class="item-list" role="main">

	<?php 
    while (bp_groups()) {
        bp_the_group();
        ?>

		<li <?php 
        bp_group_class(array('row'));
        ?>
>
			<div class="item-avatar col-md-3">
				<a href="<?php 
        bp_group_permalink();
        ?>
"><?php 
        bp_group_avatar('type=thumb&width=150&height=150');
        ?>
</a>
			</div>

			<div class="item col-md-6">
				<div class="item-title"><a href="<?php 
        bp_group_permalink();
/**
 * AJAX callback for the Groups List widget.
 *
 * @since 1.0.0
 */
function groups_ajax_widget_groups_list()
{
    check_ajax_referer('groups_widget_groups_list');
    switch ($_POST['filter']) {
        case 'newest-groups':
            $type = 'newest';
            break;
        case 'recently-active-groups':
            $type = 'active';
            break;
        case 'popular-groups':
            $type = 'popular';
            break;
    }
    $per_page = isset($_POST['max_groups']) ? intval($_POST['max_groups']) : 5;
    $groups_args = array('user_id' => 0, 'type' => $type, 'per_page' => $per_page, 'max' => $per_page);
    if (bp_has_groups($groups_args)) {
        ?>
		<?php 
        echo "0[[SPLIT]]";
        ?>
		<?php 
        while (bp_groups()) {
            bp_the_group();
            ?>
			<li <?php 
            bp_group_class();
            ?>
>
				<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 
            bp_group_name();
            ?>
"><?php 
            bp_group_name();
            ?>
</a></div>
					<div class="item-meta">
						<span class="activity">
							<?php 
            if ('newest-groups' == $_POST['filter']) {
                printf(__('created %s', 'buddypress'), bp_get_group_date_created());
            } elseif ('recently-active-groups' == $_POST['filter']) {
                printf(__('active %s', 'buddypress'), bp_get_group_last_active());
            } elseif ('popular-groups' == $_POST['filter']) {
                bp_group_member_count();
            }
            ?>
						</span>
					</div>
				</div>
			</li>
		<?php 
        }
        ?>

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

	<?php 
    } else {
        ?>

		<?php 
        echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter.", 'buddypress');
        ?>

	<?php 
    }
}