예제 #1
1
	function widget($args, $instance) {
		global $bp;

	    extract( $args );

		echo $before_widget;
		echo $before_title
		   . $widget_name
		   . $after_title; ?>

		<?php if ( bp_has_groups( 'type=popular&per_page=' . $instance['max_groups'] . '&max=' . $instance['max_groups'] ) ) : ?>
			<div class="item-options" id="groups-list-options">
				<span class="ajax-loader" id="ajax-loader-groups"></span>
				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="popular-groups" class="selected"><?php _e("Popular", 'buddypress') ?></a>
			</div>

			<ul id="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 bp_group_name() ?>"><?php bp_group_name() ?></a></div>
							<div class="item-meta"><span class="activity"><?php bp_group_member_count() ?></span></div>
						</div>
					</li>

				<?php endwhile; ?>
			</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 endif; ?>

		<?php echo $after_widget; ?>
	<?php
	}
예제 #2
0
    /**
     * Renders the widget on the front end
     *
     * @package BP Group Reviews
     * @since 1.2
     */
    function widget($args, $instance)
    {
        global $bp, $wpdb, $groups_template;
        extract($args);
        $title = esc_attr($instance['title']);
        $number = empty($instance['number']) ? 3 : (int) $instance['number'];
        $sql = apply_filters('bpgr_groups_data_sql', $wpdb->prepare("\n\t\tSELECT m1.group_id, m1.meta_value AS rating, m2.meta_value AS rating_count  \n\t\tFROM {$bp->groups->table_name_groupmeta} m1 \n\t\tLEFT JOIN {$bp->groups->table_name_groupmeta} m2 ON (m1.group_id = m2.group_id) \n\t\tWHERE m1.meta_key = 'bpgr_rating'\n\t\tAND m2.meta_key = 'bpgr_how_many_ratings'\n\t\tORDER BY rating DESC\n\t\tLIMIT 0, %d", $number));
        $ratings = $wpdb->get_results($sql, ARRAY_A);
        echo $before_widget;
        echo $before_title . $title . $after_title;
        echo '<ul class="item-list">';
        foreach ($ratings as $rating) {
            $group = new BP_Groups_Group($rating['group_id']);
            $groups_template->group = $group;
            ?>
			<li>
			 <a href="<?php 
            bp_group_permalink();
            ?>
"><?php 
            bp_group_avatar_mini();
            ?>
</a>
			 <a href="<?php 
            bp_group_permalink();
            ?>
"><?php 
            bp_group_name();
            ?>
</a>
			 <span><?php 
            echo bpgr_get_plugin_rating_html($rating['rating'], $rating['rating_count']);
            ?>
</span>
			 </li>
			<?php 
        }
        echo "</ul>";
        echo $after_widget;
    }
예제 #3
0
            ?>
					<div class="item-avatar">
						<a href="<?php 
            bp_group_permalink();
            ?>
"><?php 
            bp_group_avatar('type=thumb&width=50&height=50');
            ?>
</a>
					</div>
				<?php 
        }
        ?>

				<h4><a href="<?php 
        bp_group_permalink();
        ?>
"><?php 
        bp_group_name();
        ?>
</a><span class="small"> - <?php 
        printf(_nx('%d member', '%d members', bp_get_group_total_members(false), 'Group member count', 'buddypress'), bp_get_group_total_members(false));
        ?>
</span></h4>

				<p class="desc">
					<?php 
        bp_group_description_excerpt();
        ?>
				</p>
예제 #4
0
			<?php bp_group_list_mods() ?>

			<?php do_action( 'bp_after_group_menu_mods' ) ?>
		<?php endif; ?>

	<?php endif; ?>
</div><!-- #item-actions -->

<div id="item-header-avatar">
	<a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>">
		<?php bp_group_avatar() ?>
	</a>
</div><!-- #item-header-avatar -->

<div id="item-header-content">
	<h2><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></h2>
	<span class="highlight"><?php bp_group_type() ?></span> <span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() ) ?></span>

	<?php do_action( 'bp_before_group_header_meta' ) ?>

	<div id="item-meta">
		<?php bp_group_description() ?>

		<div id="item-buttons">

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

		</div><!-- #item-buttons -->

		<?php do_action( 'bp_group_header_meta' ) ?>
	</div>
/**
 * Outputs the tabs at the top of the Docs view (All Docs, New Doc, etc)
 *
 * At the moment, the group-specific stuff is hard coded in here.
 * @todo Get the group stuff out
 */
function bp_docs_tabs($show_create_button = true)
{
    $current_view = '';
    ?>

	<ul id="bp-docs-all-docs">
		<li<?php 
    if (bp_docs_is_global_directory()) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    bp_docs_archive_link();
    ?>
"><?php 
    _e('All Docs', 'bp-docs');
    ?>
</a></li>

		<?php 
    if (is_user_logged_in()) {
        ?>
			<?php 
        if (function_exists('bp_is_group') && bp_is_group()) {
            ?>
				<li<?php 
            if (bp_is_current_action('docs')) {
                ?>
 class="current"<?php 
            }
            ?>
><a href="<?php 
            bp_group_permalink(groups_get_current_group());
            bp_docs_slug();
            ?>
"><?php 
            printf(__("%s's Docs", 'bp-docs'), bp_get_current_group_name());
            ?>
</a></li>
			<?php 
        } else {
            ?>
				<li><a href="<?php 
            bp_docs_mydocs_started_link();
            ?>
"><?php 
            _e('Started By Me', 'bp-docs');
            ?>
</a></li>
				<li><a href="<?php 
            bp_docs_mydocs_edited_link();
            ?>
"><?php 
            _e('Edited By Me', 'bp-docs');
            ?>
</a></li>

				<?php 
            if (bp_is_active('groups')) {
                ?>
					<li<?php 
                if (bp_docs_is_mygroups_docs()) {
                    ?>
 class="current"<?php 
                }
                ?>
><a href="<?php 
                bp_docs_mygroups_link();
                ?>
"><?php 
                _e('My Groups', 'bp-docs');
                ?>
</a></li>
				<?php 
            }
            ?>
			<?php 
        }
        ?>

		<?php 
    }
    ?>

		<?php 
    if ($show_create_button) {
        ?>
			<?php 
        bp_docs_create_button();
        ?>
		<?php 
    }
    ?>

	</ul>
	<?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 
    }
예제 #7
0
        /**
         * Loads the calendar markup
         *
         * @package CollabPress
         * @subpackage CP BP
         * @since 1.2
         */
        function calendar_display()
        {
            // Render the project dropdown
            ?>
		<form action="<?php 
            bp_group_permalink(groups_get_current_group());
            ?>
calendar" method="get">
			<label for="show_cp_project"><?php 
            _e('Show tasks from: ', 'collabpress');
            ?>
</label>
			<?php 
            $this->render_project_selector();
            ?>
			<input type="submit" value="<?php 
            _e('Go', 'collabpress');
            ?>
" />
		</form>
		<?php 
            add_filter('cp_calendar_tasks_args', array($this, 'calendar_filter_task_query'));
            cp_draw_calendar();
            // Just in case it's run more than once on a page.
            remove_filter('cp_calendar_tasks_args', array($this, 'calendar_filter_task_query'));
        }
    function x_buddypress_groups_list_item_header()
    {
        ?>

    <div class="x-list-item-header">
      <div class="x-list-item-avatar-wrap item-avatar">
        <a href="<?php 
        bp_group_permalink();
        ?>
"><?php 
        bp_group_avatar('type=thumb&width=45&height=45');
        ?>
</a>
      </div>

      <div class="x-list-item-header-info item-header">
        <p>
          <a href="<?php 
        bp_group_permalink();
        ?>
"><?php 
        bp_group_name();
        ?>
</a>
          <span class="activity"><?php 
        printf(__('active %s', 'buddypress'), bp_get_group_last_active());
        ?>
</span>
        </p>
      </div>
    </div>

  <?php 
    }
    /**
     * groups home: add the sidebars and their default widgets to the groups header
     *
     * located: grous/home.php do_action( 'bp_before_group_home_content' )
     *
     * @package Custom Community
     * @since 1.8.3
     */
    function before_group_home_content()
    {
        global $cap;
        if ($cap->bp_groups_header == false || $cap->bp_groups_header == 'on' || $cap->bp_groups_header == __('on', 'cc')) {
            ?>
			<div id="item-header">
                <div class="row-fluid">
                    <?php 
            if (!dynamic_sidebar('groupheader')) {
                ?>
                     <?php 
                locate_template(array('groups/single/group-header.php'), true);
                ?>
                    <?php 
            }
            ?>

                    <?php 
            if (is_active_sidebar('groupheaderleft')) {
                ?>
                        <div class="widgetarea cc-widget span4">
                        <?php 
                dynamic_sidebar('groupheaderleft');
                ?>
                        </div>
                    <?php 
            }
            ?>
                    <?php 
            if (is_active_sidebar('groupheadercenter')) {
                ?>
                        <div class="<?php 
                if (!is_active_sidebar('groupheaderleft')) {
                    echo 'group-header-left';
                }
                ?>
 widgetarea cc-widget span4">
                        <?php 
                dynamic_sidebar('groupheadercenter');
                ?>
                        </div>
                    <?php 
            }
            ?>
                    <?php 
            if (is_active_sidebar('groupheaderright')) {
                ?>
                        <div class="widgetarea cc-widget cc-widget-right span4">
                        <?php 
                dynamic_sidebar('groupheaderright');
                ?>
                        </div>
                    <?php 
            }
            ?>
                </div>
			</div>
		<?php 
        } else {
            ?>
			<div id="item-header">
				<h2><a href="<?php 
            bp_group_permalink();
            ?>
" title="<?php 
            bp_group_name();
            ?>
"><?php 
            bp_group_name();
            ?>
</a></h2>
			</div>
		<?php 
        }
        ?>
		<?php 
        if ($cap->bp_default_navigation == true) {
            ?>
			<div id="item-nav">
				<div class="item-list-tabs no-ajax" id="object-nav">
					<ul>
						<?php 
            bp_get_options_nav();
            ?>

						<?php 
            do_action('bp_group_options_nav');
            ?>
					</ul>
				</div>
			</div><!-- #item-nav -->
		<?php 
        }
    }
/**
 * 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 
    }
}
예제 #11
0
/**
 * bp_groupblog_options_nav()
 *
 * Manually create the navigation for the group since we can't fetch any other way.
 * You should manually add items if you have third party plugins that add a menu item.
 *
 * The BuddyPress function we duplicate is called bp_get_options_nav()
 */
function bp_groupblog_options_nav()
{
    global $bp;
    $checks = get_site_option('bp_groupblog_blog_defaults_options');
    ?>

	  <li id="home-personal-li"<?php 
    if ($checks['deep_group_integration']) {
        ?>
 class="current selected"<?php 
    }
    ?>
>
			<a id="home" href="<?php 
    bp_group_permalink();
    ?>
"><?php 
    _e('Home', 'groupblog');
    ?>
</a>
		</li>

    <?php 
    if (groups_is_user_admin($bp->loggedin_user->id, bp_get_group_id()) || groups_is_user_mod($bp->loggedin_user->id, bp_get_group_id())) {
        ?>
			<li id="admin-personal-li" >
				<a id="admin" href="<?php 
        bp_group_permalink();
        ?>
admin/"><?php 
        _e('Admin', 'groupblog');
        ?>
</a>
			</li>
		<?php 
    }
    ?>

		<?php 
    if (bp_group_is_visible()) {
        ?>

			<?php 
        if (bp_groupblog_is_blog_enabled(bp_get_group_id())) {
            ?>
				<?php 
            if (!$checks['deep_group_integration']) {
                ?>
					<li id="<?php 
                echo BP_GROUPBLOG_SLUG;
                ?>
-personal-li"<?php 
                //if ( is_page() ) :
                ?>
 class="current selected"<?php 
                //endif;
                ?>
>
						<a id="<?php 
                echo BP_GROUPBLOG_SLUG;
                ?>
" href="<?php 
                bp_group_permalink();
                ?>
blog/"><?php 
                _e('Blog', 'groupblog');
                ?>
</a>
					</li>
				<?php 
            }
            ?>
		  <?php 
        }
        ?>

			<?php 
        if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && bp_group_is_forum_enabled() && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) {
            ?>
				<li id="<?php 
            echo BP_FORUMS_SLUG;
            ?>
-personal-li" >
					<a id="<?php 
            echo BP_FORUMS_SLUG;
            ?>
" href="<?php 
            bp_group_permalink();
            ?>
forum/"><?php 
            _e('Forum', 'groupblog');
            ?>
</a>
				</li>
			<?php 
        }
        ?>

			<li id="<?php 
        echo BP_MEMBERS_SLUG;
        ?>
-personal-li" >
				<a id="<?php 
        echo BP_MEMBERS_SLUG;
        ?>
" href="<?php 
        bp_group_permalink();
        ?>
members/"><?php 
        _e('Members', 'groupblog');
        ?>
 (<?php 
        bp_group_total_members();
        ?>
)</a>
			</li>

			<li id="invite-personal-li" >
				<a id="invite" href="<?php 
        bp_group_permalink();
        ?>
send-invites/"><?php 
        _e('Send Invites', 'groupblog');
        ?>
</a>
			</li>

		<?php 
    } elseif (!bp_group_is_visible() && bp_get_group_status() != 'hidden') {
        ?>

			<li id="request-membership-personal-li" >
				<a id="request-membership" href="<?php 
        bp_group_permalink();
        ?>
request-membership/"><?php 
        _e('Request Membership', 'groupblog');
        ?>
</a>
			</li>

		<?php 
    }
    ?>

	<?php 
}
    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 
    }
예제 #13
0
    function display($page = 1)
    {
        global $bp, $groups_template;
        $parent_template = $groups_template;
        $hide_button = false;
        if (isset($_REQUEST['grpage'])) {
            $page = (int) $_REQUEST['grpage'];
        } else {
            if (!is_numeric($page)) {
                $page = 1;
            } else {
                $page = (int) $page;
            }
        }
        /** Respect BuddyPress group creation restriction */
        if (function_exists('bp_user_can_create_groups')) {
            $hide_button = !bp_user_can_create_groups();
        }
        bp_has_groups_hierarchy(array('type' => 'alphabetical', 'parent_id' => $bp->groups->current_group->id, 'page' => $page));
        ?>
		<div class="group">

			<?php 
        if (($bp->is_item_admin || $bp->groups->current_group->can_create_subitems) && !$hide_button) {
            ?>
			<div class="generic-button group-button">
				<a title="<?php 
            printf(__('Create a %s', 'bp-group-hierarchy'), __('Member Group', 'bp-group-hierarchy'));
            ?>
" href="<?php 
            echo $bp->root_domain . '/' . bp_get_groups_root_slug() . '/' . 'create' . '/?parent_id=' . $bp->groups->current_group->id;
            ?>
"><?php 
            printf(__('Create a %s', 'bp-group-hierarchy'), __('Member Group', 'bp-group-hierarchy'));
            ?>
</a>
			</div><br /><br />
			<?php 
        }
        ?>

		<?php 
        if ($groups_template && count($groups_template->groups) > 0) {
            ?>

			<div id="pag-top" class="pagination">
				<div class="pag-count" id="group-dir-count-top">
					<?php 
            bp_groups_pagination_count();
            ?>
				</div>
		
				<div class="pagination-links" id="group-dir-pag-top">
					<?php 
            bp_groups_pagination_links();
            ?>
				</div>
			</div>
	
			<ul id="groups-list" class="item-list">
				<?php 
            while (bp_groups()) {
                bp_the_group();
                ?>
				<?php 
                $subgroup = $groups_template->group;
                ?>
				<?php 
                if ($subgroup->status == 'hidden' && !(groups_is_user_member($bp->loggedin_user->id, $subgroup->id) || groups_is_user_admin($bp->loggedin_user->id, $bp->groups->current_group->id))) {
                    continue;
                }
                ?>
				<li id="tree-childof_<?php 
                bp_group_id();
                ?>
">
					<div class="item-avatar">
						<a href="<?php 
                bp_group_permalink();
                ?>
"><?php 
                bp_group_avatar('type=thumb&width=50&height=50');
                ?>
</a>
					</div>
		
					<div class="item">
						<div class="item-title"><a href="<?php 
                bp_group_permalink();
                ?>
"><?php 
                bp_group_name();
                ?>
</a></div>
						<div class="item-meta"><span class="activity"><?php 
                printf(__('active %s', 'buddypress'), bp_get_group_last_active());
                ?>
</span></div>
						<div class="item-desc"><?php 
                bp_group_description_excerpt();
                ?>
</div>
		
						<?php 
                do_action('bp_directory_groups_item');
                ?>
		
					</div>
		
					<div class="action">
						<?php 
                do_action('bp_directory_groups_actions');
                ?>
						<div class="meta">
							<?php 
                bp_group_type();
                ?>
 / <?php 
                bp_group_member_count();
                ?>
						</div>
					</div>
					<div class="clear"></div>
				</li>
		
				<?php 
            }
            ?>
			</ul>
			<div id="pag-bottom" class="pagination">
		
				<div class="pag-count" id="group-dir-count-bottom">
					<?php 
            bp_groups_pagination_count();
            ?>
				</div>
		
				<div class="pagination-links" id="group-dir-pag-bottom">
					<?php 
            bp_groups_pagination_links();
            ?>
				</div>
		
			</div>
			<script type="text/javascript">
			jQuery('#nav-hierarchy-personal-li').attr('id','group-hierarchy-personal-li');
			jQuery('#nav-hierarchy-groups-li').attr('id','group-hierarchy-group-li');
			</script>
			
		<?php 
        } else {
            ?>
		<p><?php 
            _e('No member groups were found.', 'bp-group-hierarchy');
            ?>
</p>
		<?php 
        }
        ?>
		</div>
		<?php 
        // reset the $groups_template global and continue with the page
        $groups_template = $parent_template;
    }
function bp_groupblog_admin_form_action($page, $group = false)
{
    global $bp, $groups_template;
    if (!$group) {
        $group =& $groups_template->group;
    }
    echo apply_filters('bp_groupblog_admin_form_action', bp_group_permalink($group, false) . '/admin/' . $page);
}
예제 #15
0
/**
 * Display the single groups edit screen.
 *
 * @since 1.7.0
 */
function bp_groups_admin_edit()
{
    if (!current_user_can('bp_moderate')) {
        die('-1');
    }
    $messages = array();
    // If the user has just made a change to a group, build status messages
    if (!empty($_REQUEST['no_admins']) || !empty($_REQUEST['error']) || !empty($_REQUEST['updated']) || !empty($_REQUEST['error_new']) || !empty($_REQUEST['success_new']) || !empty($_REQUEST['error_modified']) || !empty($_REQUEST['success_modified'])) {
        $no_admins = !empty($_REQUEST['no_admins']) ? 1 : 0;
        $errors = !empty($_REQUEST['error']) ? $_REQUEST['error'] : '';
        $updated = !empty($_REQUEST['updated']) ? $_REQUEST['updated'] : '';
        $error_new = !empty($_REQUEST['error_new']) ? explode(',', $_REQUEST['error_new']) : array();
        $success_new = !empty($_REQUEST['success_new']) ? explode(',', $_REQUEST['success_new']) : array();
        $error_modified = !empty($_REQUEST['error_modified']) ? explode(',', $_REQUEST['error_modified']) : array();
        $success_modified = !empty($_REQUEST['success_modified']) ? explode(',', $_REQUEST['success_modified']) : array();
        if (!empty($no_admins)) {
            $messages[] = __('You cannot remove all administrators from a group.', 'buddypress');
        }
        if (!empty($errors)) {
            switch ($errors) {
                case -1:
                    $messages[] = __('Group name cannot be empty.', 'buddypress');
                    break;
                case -2:
                    $messages[] = __('Group description cannot be empty.', 'buddypress');
                    break;
                case -3:
                    $messages[] = __('Group name and description cannot be empty.', 'buddypress');
                    break;
                default:
                    $messages[] = __('An error occurred when trying to update your group details.', 'buddypress');
                    break;
            }
        } elseif (!empty($updated)) {
            $messages[] = __('The group has been updated successfully.', 'buddypress');
        }
        if (!empty($error_new)) {
            $messages[] = sprintf(__('The following users could not be added to the group: <em>%s</em>', 'buddypress'), implode(', ', $error_new));
        }
        if (!empty($success_new)) {
            $messages[] = sprintf(__('The following users were successfully added to the group: <em>%s</em>', 'buddypress'), implode(', ', $success_new));
        }
        if (!empty($error_modified)) {
            $error_modified = bp_groups_admin_get_usernames_from_ids($error_modified);
            $messages[] = sprintf(__('An error occurred when trying to modify the following members: <em>%s</em>', 'buddypress'), implode(', ', $error_modified));
        }
        if (!empty($success_modified)) {
            $success_modified = bp_groups_admin_get_usernames_from_ids($success_modified);
            $messages[] = sprintf(__('The following members were successfully modified: <em>%s</em>', 'buddypress'), implode(', ', $success_modified));
        }
    }
    $is_error = !empty($no_admins) || !empty($errors) || !empty($error_new) || !empty($error_modified);
    // Get the group from the database
    $group = groups_get_group('group_id=' . $_GET['gid']);
    /** This filter is documented in bp-groups/bp-groups-template.php */
    $group_name = isset($group->name) ? apply_filters('bp_get_group_name', $group->name) : '';
    // Construct URL for form
    $form_url = remove_query_arg(array('action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified'), $_SERVER['REQUEST_URI']);
    $form_url = add_query_arg('action', 'save', $form_url);
    /**
     * Fires before the display of the edit form.
     *
     * Useful for plugins to modify the group before display.
     *
     * @since 1.7.0
     *
     * @param BP_Groups_Group $this Instance of the current group being edited. Passed by reference.
     */
    do_action_ref_array('bp_groups_admin_edit', array(&$group));
    ?>

	<div class="wrap">
		<?php 
    screen_icon('buddypress-groups');
    ?>
		<h2><?php 
    _e('Edit Group', 'buddypress');
    ?>

			<?php 
    if (is_user_logged_in() && bp_user_can_create_groups()) {
        ?>
				<a class="add-new-h2" href="<?php 
        echo trailingslashit(bp_get_groups_directory_permalink() . 'create');
        ?>
"><?php 
        _e('Add New', 'buddypress');
        ?>
</a>
			<?php 
    }
    ?>

		</h2>

		<?php 
    // If the user has just made a change to an group, display the status messages
    ?>
		<?php 
    if (!empty($messages)) {
        ?>
			<div id="moderated" class="<?php 
        echo $is_error ? 'error' : 'updated';
        ?>
"><p><?php 
        echo implode("</p><p>", $messages);
        ?>
</p></div>
		<?php 
    }
    ?>

		<?php 
    if (!empty($group)) {
        ?>

			<form action="<?php 
        echo esc_url($form_url);
        ?>
" id="bp-groups-edit-form" method="post">
				<div id="poststuff">

					<div id="post-body" class="metabox-holder columns-<?php 
        echo 1 == get_current_screen()->get_columns() ? '1' : '2';
        ?>
">
						<div id="post-body-content">
							<div id="postdiv">
								<div id="bp_groups_name" class="postbox">
									<h3><?php 
        _e('Name and Description', 'buddypress');
        ?>
</h3>
									<div class="inside">
										<label for="bp-groups-name" class="screen-reader-text"><?php 
        _e('Group Name', 'buddypress');
        ?>
</label>
										<input type="text" name="bp-groups-name" id="bp-groups-name" value="<?php 
        echo esc_attr(stripslashes($group_name));
        ?>
" />
										<div id="bp-groups-permalink-box">
											<strong><?php 
        esc_html_e('Permalink:', 'buddypress');
        ?>
</strong> <span id="sample-permalink"><?php 
        bp_group_permalink($group);
        ?>
</span> <a href="<?php 
        echo bp_group_permalink($group);
        ?>
" class="button button-small" id="bp-groups-visit-group"><?php 
        esc_html_e('Visit Group', 'buddypress');
        ?>
</a>
										</div>

										<label for="bp-groups-description" class="screen-reader-text"><?php 
        _e('Group Description', 'buddypress');
        ?>
</label>
										<?php 
        wp_editor(stripslashes($group->description), 'bp-groups-description', array('media_buttons' => false, 'teeny' => true, 'textarea_rows' => 5, 'quicktags' => array('buttons' => 'strong,em,link,block,del,ins,img,code,spell,close')));
        ?>
									</div>
								</div>
							</div>
						</div><!-- #post-body-content -->

						<div id="postbox-container-1" class="postbox-container">
							<?php 
        do_meta_boxes(get_current_screen()->id, 'side', $group);
        ?>
						</div>

						<div id="postbox-container-2" class="postbox-container">
							<?php 
        do_meta_boxes(get_current_screen()->id, 'normal', $group);
        ?>
							<?php 
        do_meta_boxes(get_current_screen()->id, 'advanced', $group);
        ?>
						</div>
					</div><!-- #post-body -->

				</div><!-- #poststuff -->
				<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
				<?php 
        wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        ?>
				<?php 
        wp_nonce_field('edit-group_' . $group->id);
        ?>
			</form>

		<?php 
    } else {
        ?>
			<p><?php 
        printf(__('No group found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress'), esc_url(bp_get_admin_url('admin.php?page=bp-groups')));
        ?>
</p>
		<?php 
    }
    ?>

	</div><!-- .wrap -->

<?php 
}
예제 #16
0
    <div class="clearfix"></div>

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

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

		<li class="yit_animate fadeInUp col-md-4 col-sm-6 masonry_item">
            <div class="item-container">
                <div class="item-header clearfix">
                    <div class="item-avatar">
                        <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
                    </div>

                    <div class="item">
                        <div class="item-username"><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a></div>
                        <div class="item-meta"><span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span></div>
                    </div>
                </div>

                <div class="item-quote">
                    <div class="item-desc"><?php bp_group_description_excerpt(); ?></div>

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

                </div>

                <div class="action">

				<?php //do_action( 'bp_directory_groups_actions' ); ?>
예제 #17
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');
        }
        echo $before_widget;
        $title = !empty($instance['link_title']) ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '">' . $instance['title'] . '</a>' : $instance['title'];
        echo $before_title . $title . $after_title;
        ?>

		<?php 
        if (bp_has_groups('user_id=' . $user_id . '&type=' . $instance['group_default'] . '&max=' . $instance['max_groups'] . '&per_page=' . $instance['max_groups'])) {
            ?>
			<div class="item-options" id="groups-list-options">
				<a href="<?php 
            echo site_url(bp_get_groups_root_slug());
            ?>
" id="newest-groups"<?php 
            if ($instance['group_default'] == 'newest') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Newest", 'buddypress');
            ?>
</a> |
				<a href="<?php 
            echo site_url(bp_get_groups_root_slug());
            ?>
" id="recently-active-groups"<?php 
            if ($instance['group_default'] == 'active') {
                ?>
 class="selected"<?php 
            }
            ?>
><?php 
            _e("Active", 'buddypress');
            ?>
</a> |
				<a href="<?php 
            echo site_url(bp_get_groups_root_slug());
            ?>
" 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>
						<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());
                } else {
                    if ('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 
    }
예제 #18
0
파일: invites.php 프로젝트: n-sane/zaroka
<?php do_action( 'bp_before_group_invites_content' ) ?>

<?php if ( bp_has_groups( 'type=invites&user_id=' . bp_loggedin_user_id() ) ) : ?>

	<ul id="group-list" class="invites item-list">

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

			<li>
				<?php bp_group_avatar_thumb() ?>
				<h4><a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?></a><span class="small"> - <?php printf( __( '%s members', 'buddypress' ), bp_group_total_members( false ) ) ?></span></h4>

				<p class="desc">
					<?php bp_group_description_excerpt() ?>
				</p>

				<?php do_action( 'bp_group_invites_item' ) ?>

				<div class="action">
					<a class="button accept" href="<?php bp_group_accept_invite_link() ?>"><?php _e( 'Accept', 'buddypress' ) ?></a> &nbsp;
					<a class="button reject confirm" href="<?php bp_group_reject_invite_link() ?>"><?php _e( 'Reject', 'buddypress' ) ?></a>

					<?php do_action( 'bp_group_invites_item_action' ) ?>

				</div>
			</li>

		<?php endwhile; ?>
	</ul>

<?php else: ?>