/**
 * @since 1.0.0
 *
 * @return bool
 */
function bp_group_creation_tabs()
{
    $bp = buddypress();
    if (!is_array($bp->groups->group_creation_steps)) {
        return false;
    }
    if (!bp_get_groups_current_create_step()) {
        $keys = array_keys($bp->groups->group_creation_steps);
        $bp->groups->current_create_step = array_shift($keys);
    }
    $counter = 1;
    foreach ((array) $bp->groups->group_creation_steps as $slug => $step) {
        $is_enabled = bp_are_previous_group_creation_steps_complete($slug);
        ?>

		<li<?php 
        if (bp_get_groups_current_create_step() == $slug) {
            ?>
 class="current"<?php 
        }
        ?>
><?php 
        if ($is_enabled) {
            ?>
<a href="<?php 
            bp_groups_directory_permalink();
            ?>
create/step/<?php 
            echo $slug;
            ?>
/"><?php 
        } else {
            ?>
<span><?php 
        }
        echo $counter;
        ?>
. <?php 
        echo $step['name'];
        if ($is_enabled) {
            ?>
</a><?php 
        } else {
            ?>
</span><?php 
        }
        ?>
</li><?php 
        $counter++;
    }
    unset($is_enabled);
    /**
     * Fires at the end of the creation of the group tabs.
     *
     * @since 1.0.0
     */
    do_action('groups_creation_tabs');
}
Esempio 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 
    }
Esempio n. 3
0
<div id="buddypress" class="container">

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

	<?php 
do_action('bp_before_directory_groups_content');
?>
	
	<div class="group-top clearfix">
	
		<div id="group-links" class="item-list-tabs" role="navigation">
			<ul>
				<li class="selected" id="groups-all"><a href="<?php 
bp_groups_directory_permalink();
?>
"><?php 
printf(__('All Groups <span>%s</span>', 'buddypress'), bp_get_total_group_count());
?>
</a></li>

				<?php 
if (is_user_logged_in() && bp_get_total_group_count_for_user(bp_loggedin_user_id())) {
    ?>
					<li id="groups-personal"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_groups_slug() . '/my-groups/';
    ?>
"><?php 
    printf(__('My Groups <span>%s</span>', 'buddypress'), bp_get_total_group_count_for_user(bp_loggedin_user_id()));
    ?>
    /**
     * 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 
    }
Esempio n. 5
0
/**
 * Output the Random BuddyBar menu.
 *
 * Not visible for logged-in users.
 *
 * @deprecated BuddyPress (2.1.0)
 */
function bp_adminbar_random_menu()
{
    ?>

	<li class="align-right" id="bp-adminbar-visitrandom-menu">
		<a href="#"><?php 
    _e('Visit', 'buddypress');
    ?>
</a>
		<ul class="random-list">
			<li><a href="<?php 
    bp_members_directory_permalink();
    ?>
?random-member" rel="nofollow"><?php 
    _e('Random Member', 'buddypress');
    ?>
</a></li>

			<?php 
    if (bp_is_active('groups')) {
        ?>

				<li class="alt"><a href="<?php 
        bp_groups_directory_permalink();
        ?>
?random-group"  rel="nofollow"><?php 
        _e('Random Group', 'buddypress');
        ?>
</a></li>

			<?php 
    }
    ?>

			<?php 
    if (is_multisite() && bp_is_active('blogs')) {
        ?>

				<li><a href="<?php 
        bp_blogs_directory_permalink();
        ?>
?random-blog"  rel="nofollow"><?php 
        _e('Random Site', 'buddypress');
        ?>
</a></li>

			<?php 
    }
    ?>

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

		</ul>
	</li>

	<?php 
}