Example #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
	}
Example #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;
    }
Example #3
0
function invite_anyone_screen_one_content()
{
    global $bp;
    $iaoptions = invite_anyone_options();
    // Hack - catch already=accepted
    if (!empty($_GET['already']) && 'accepted' === $_GET['already'] && bp_is_my_profile()) {
        _e('It looks like you&#8217;ve already accepted your invitation to join the site.', 'invite-anyone');
        return;
    }
    // If the user has maxed out his invites, no need to go on
    if (!empty($iaoptions['email_limit_invites_toggle']) && $iaoptions['email_limit_invites_toggle'] == 'yes' && !current_user_can('delete_others_pages')) {
        $sent_invites = invite_anyone_get_invitations_by_inviter_id(bp_displayed_user_id());
        $sent_invites_count = $sent_invites->post_count;
        if ($sent_invites_count >= $iaoptions['limit_invites_per_user']) {
            ?>

			<h4><?php 
            _e('Invite New Members', 'invite-anyone');
            ?>
</h4>

			<p id="welcome-message"><?php 
            _e('You have sent the maximum allowed number of invitations.', 'invite-anyone');
            ?>
</em></p>

			<?php 
            return;
        }
    }
    if (!($max_invites = $iaoptions['max_invites'])) {
        $max_invites = 5;
    }
    $from_group = false;
    if (!empty($bp->action_variables)) {
        if ('group-invites' == $bp->action_variables[0]) {
            $from_group = $bp->action_variables[1];
        }
    }
    $returned_data = !empty($bp->invite_anyone->returned_data) ? $bp->invite_anyone->returned_data : false;
    /* If the user is coming from the widget, $returned_emails is populated with those email addresses */
    if (isset($_POST['invite_anyone_widget'])) {
        check_admin_referer('invite-anyone-widget_' . $bp->loggedin_user->id);
        if (!empty($_POST['invite_anyone_email_addresses'])) {
            $returned_data['error_emails'] = invite_anyone_parse_addresses($_POST['invite_anyone_email_addresses']);
        }
        /* If the widget appeared on a group page, the group ID should come along with it too */
        if (isset($_POST['invite_anyone_widget_group'])) {
            $returned_data['groups'] = $_POST['invite_anyone_widget_group'];
        }
    }
    // $returned_groups is padded so that array_search (below) returns true for first group */
    $counter = 0;
    $returned_groups = array(0);
    if (!empty($returned_data['groups'])) {
        foreach ($returned_data['groups'] as $group_id) {
            $returned_groups[] = $group_id;
        }
    }
    // Get the returned email subject, if there is one
    $returned_subject = !empty($returned_data['subject']) ? stripslashes($returned_data['subject']) : false;
    // Get the returned email message, if there is one
    $returned_message = !empty($returned_data['message']) ? stripslashes($returned_data['message']) : false;
    if (!empty($returned_data['error_message'])) {
        ?>
		<div class="invite-anyone-error error">
			<p><?php 
        _e("Some of your invitations were not sent. Please see the errors below and resubmit the failed invitations.", 'invite-anyone');
        ?>
</p>
		</div>
		<?php 
    }
    $blogname = get_bloginfo('name');
    $welcome_message = sprintf(__('Invite friends to join %s by following these steps:', 'invite-anyone'), $blogname);
    ?>
	<form id="invite-anyone-by-email" action="<?php 
    echo $bp->displayed_user->domain . $bp->invite_anyone->slug . '/sent-invites/send/';
    ?>
" method="post">

	<h4><?php 
    _e('Invite New Members', 'invite-anyone');
    ?>
</h4>

	<?php 
    if (isset($iaoptions['email_limit_invites_toggle']) && $iaoptions['email_limit_invites_toggle'] == 'yes' && !current_user_can('delete_others_pages')) {
        if (!isset($sent_invites)) {
            $sent_invites = invite_anyone_get_invitations_by_inviter_id(bp_loggedin_user_id());
            $sent_invites_count = $sent_invites->post_count;
        }
        $limit_invite_count = (int) $iaoptions['limit_invites_per_user'] - (int) $sent_invites_count;
        if ($limit_invite_count < 0) {
            $limit_invite_count = 0;
        }
        ?>

		<p class="description"><?php 
        printf(__('The site administrator has limited each user to %1$d invitations. You have %2$d invitations remaining.', 'invite-anyone'), (int) $iaoptions['limit_invites_per_user'], (int) $limit_invite_count);
        ?>
</p>

		<?php 
    }
    ?>

	<p id="welcome-message"><?php 
    echo $welcome_message;
    ?>
</p>

	<ol id="invite-anyone-steps">

		<li>
			<?php 
    if (!empty($returned_data['error_message'])) {
        ?>
				<div class="invite-anyone-error error">
					<p><?php 
        echo $returned_data['error_message'];
        ?>
</p>
				</div>
			<?php 
    }
    ?>

			<div class="manual-email">
				<p>
					<?php 
    _e('Enter email addresses below, one per line.', 'invite-anyone');
    ?>
					<?php 
    if (invite_anyone_allowed_domains()) {
        ?>
 <?php 
        _e('You can only invite people whose email addresses end in one of the following domains:', 'invite-anyone');
        ?>
 <?php 
        echo invite_anyone_allowed_domains();
    }
    ?>
				</p>

				<?php 
    if (false !== ($max_no_invites = invite_anyone_max_invites())) {
        ?>
					<p class="description"><?php 
        printf(__('You can invite a maximum of %s people at a time.', 'invite-anyone'), $max_no_invites);
        ?>
</p>
				<?php 
    }
    ?>
				<?php 
    invite_anyone_email_fields($returned_data['error_emails']);
    ?>
			</div>

			<?php 
    /* invite_anyone_after_addresses gets $iaoptions so that Cloudsponge etc can tell whether certain components are activated, without an additional lookup */
    ?>
			<?php 
    do_action('invite_anyone_after_addresses', $iaoptions);
    ?>

		</li>

		<li>
			<?php 
    if ($iaoptions['subject_is_customizable'] == 'yes') {
        ?>
				<label for="invite-anyone-custom-subject"><?php 
        _e('(optional) Customize the subject line of the invitation email.', 'invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" ><?php 
        echo invite_anyone_invitation_subject($returned_subject);
        ?>
</textarea>
			<?php 
    } else {
        ?>
				<label for="invite-anyone-custom-subject"><?php 
        _e('Subject: <span class="disabled-subject">Subject line is fixed</span>', 'invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" disabled="disabled"><?php 
        echo invite_anyone_invitation_subject($returned_subject);
        ?>
 </textarea>

				<input type="hidden" id="invite-anyone-customised-subject" name="invite_anyone_custom_subject" value="<?php 
        echo invite_anyone_invitation_subject();
        ?>
" />
			<?php 
    }
    ?>
		</li>

		<li>
			<?php 
    if ($iaoptions['message_is_customizable'] == 'yes') {
        ?>
				<label for="invite-anyone-custom-message"><?php 
        _e('(optional) Customize the text of the invitation.', 'invite-anyone');
        ?>
</label>
				<p class="description"><?php 
        _e('The message will also contain a custom footer containing links to accept the invitation or opt out of further email invitations from this site.', 'invite-anyone');
        ?>
</p>
					<textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" cols="40" rows="10"><?php 
        echo invite_anyone_invitation_message($returned_message);
        ?>
</textarea>
			<?php 
    } else {
        ?>
				<label for="invite-anyone-custom-message"><?php 
        _e('Message:', 'invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" disabled="disabled"><?php 
        echo invite_anyone_invitation_message($returned_message);
        ?>
</textarea>

				<input type="hidden" name="invite_anyone_custom_message" value="<?php 
        echo invite_anyone_invitation_message();
        ?>
" />
			<?php 
    }
    ?>

		</li>

		<?php 
    if (invite_anyone_are_groups_running()) {
        ?>
			<?php 
        if ($iaoptions['can_send_group_invites_email'] == 'yes' && bp_has_groups("per_page=10000&type=alphabetical&user_id=" . bp_loggedin_user_id())) {
            ?>
			<li>
				<p><?php 
            _e('(optional) Select some groups. Invitees will receive invitations to these groups when they join the site.', 'invite-anyone');
            ?>
</p>
				<ul id="invite-anyone-group-list">
					<?php 
            while (bp_groups()) {
                bp_the_group();
                ?>
						<?php 
                // Enforce per-group invitation settings
                if (!bp_groups_user_can_send_invites(bp_get_group_id()) || 'anyone' !== invite_anyone_group_invite_access_test(bp_get_group_id())) {
                    continue;
                }
                ?>
						<li>
						<input type="checkbox" name="invite_anyone_groups[]" id="invite_anyone_groups-<?php 
                bp_group_id();
                ?>
" value="<?php 
                bp_group_id();
                ?>
" <?php 
                if ($from_group == bp_get_group_id() || array_search(bp_get_group_id(), $returned_groups)) {
                    ?>
checked<?php 
                }
                ?>
 />

						<label for="invite_anyone_groups-<?php 
                bp_group_id();
                ?>
" class="invite-anyone-group-name"><?php 
                bp_group_avatar_mini();
                ?>
 <span><?php 
                bp_group_name();
                ?>
</span></label>

						</li>
					<?php 
            }
            ?>

				</ul>
			</li>
			<?php 
        }
        ?>

		<?php 
    }
    ?>

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

	</ol>

	<div class="submit">
		<input type="submit" name="invite-anyone-submit" id="invite-anyone-submit" value="<?php 
    _e('Send Invites', 'buddypress');
    ?>
 " />
	</div>


	</form>
	<?php 
}
		<div class="info-group">
			<h4><?php 
        _e('Request Membership', 'buddypress');
        ?>
</h4>
			
			<?php 
        do_action('template_notices');
        ?>

			<?php 
        if (!bp_group_has_requested_membership()) {
            ?>
				<p><?php 
            printf(__("You are requesting to become a member of the group '%s'.", "buddypress"), bp_group_name(false, false));
            ?>
</p>

				<form action="<?php 
            bp_group_form_action('request-membership');
            ?>
" method="post" name="request-membership-form" id="request-membership-form" class="standard-form">
					<label for="group-request-membership-comments"><?php 
            _e('Comments (optional)', 'buddypress');
            ?>
</label>
					<textarea name="group-request-membership-comments" id="group-request-membership-comments"></textarea>

					<p><input type="submit" name="group-request-send" id="group-request-send" value="<?php 
            _e('Send Request', 'buddypress');
    /**
     * 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 
    }
Example #6
0
			<?php 
        }
        ?>
			
			<?php 
        do_action('groups_custom_group_boxes');
        ?>
		
			<?php 
        if (bp_group_is_visible() && bp_group_is_wire_enabled()) {
            ?>
				<?php 
            if (function_exists('bp_wire_get_post_list')) {
                ?>
					<?php 
                bp_wire_get_post_list(bp_group_id(false, false), __('Group Wire', 'buddypress'), sprintf(__('There are no wire posts for %s', 'buddypress'), bp_group_name(false)), bp_group_is_member(), true);
                ?>
				<?php 
            }
            ?>
			<?php 
        }
        ?>
		
		</div>

	<?php 
    }
} else {
    ?>
		<div id="message" class="error">
    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 
        }
    }
Example #9
0
						<option selected="selected" value="0"><?php 
    _e('My Profile', 'buddypress');
    ?>
</option>

						<?php 
    if (bp_has_groups('user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0')) {
        while (bp_groups()) {
            bp_the_group();
            ?>

								<option value="<?php 
            bp_group_id();
            ?>
"><?php 
            bp_group_name();
            ?>
</option>

							<?php 
        }
    }
    ?>

					</select>
				</div>
				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />

			<?php 
} elseif (bp_is_group_home()) {
    ?>
function bp_group_management_admin_main()
{
    /* Group delete requests are sent back to the main page. This handles group deletions */
    if (isset($_GET['group_action']) && $_GET['group_action'] == 'delete') {
        if (!check_admin_referer('bp-group-management-action_group_delete')) {
            return false;
        }
        if (!bp_group_management_delete_group($_GET['id'])) {
            ?>
			<div id="message" class="updated fade"><p><?php 
            _e('Sorry, there was an error.', 'bp-group-management');
            ?>
</p></div>
		<?php 
        } else {
            ?>
			<div id="message" class="updated fade"><p><?php 
            _e('Group deleted.', 'bp-group-management');
            ?>
</p></div>
		<?php 
            do_action('groups_group_deleted', $bp->groups->current_group->id);
        }
    }
    ?>

          <div class="wrap bp-gm-wrap">


            <h2><?php 
    _e('Group Management', 'bp-group-management');
    ?>
</h2>
            <br />
            <?php 
    if (!($options = get_option('bp_gm_settings'))) {
        $per_page = 10;
    } else {
        $per_page = $options['groups_per_page'];
    }
    $args = array('type' => 'alphabetical', 'per_page' => $per_page);
    $order = isset($_GET['order']) ? $_GET['order'] : false;
    if ($order == 'name') {
        $args['type'] = 'alphabetical';
    } else {
        if ($order == 'group_id') {
            $args['type'] = 'newest';
        } else {
            if ($order == 'popular') {
                $args['type'] = 'popular';
            }
        }
    }
    $args['page'] = isset($_GET['grpage']) ? $_GET['grpage'] : 1;
    if (bp_has_groups($args)) {
        global $groups_template;
        ?>

            <div class="tablenav">
    			<div class="tablenav-pages">
					<span class="displaying-num" id="group-dir-count">
						<?php 
        bp_groups_pagination_count();
        ?>
					</span>

					<span class="page-numbers" id="group-dir-pag">
						<?php 
        bp_group_management_pagination_links();
        ?>
					</span>

				</div>
			</div>



            <table width="100%" cellpadding="3" cellspacing="3" class="widefat">
			<thead>
				<tr>
					<th scope="col" class="check-column"></th>
            		<th scope="col" class="bp-gm-group-id-header"><a href="admin.php?page=bp-group-management&amp;order=group_id"><?php 
        _e('Group ID', 'bp-group-management');
        ?>
</a></th>

					<th scope="col"><?php 
        _e('Group avatar', 'bp-group-management');
        ?>
</th>
            		<th scope="col"><a href="admin.php?page=bp-group-management&amp;order=name"><?php 
        _e('Group Name', 'bp-group-management');
        ?>
</a></th>
            		<th scope="col"><?php 
        _e('Group type', 'bp-group-management');
        ?>
</th>
            		<th scope="col"><a href="admin.php?page=bp-group-management&amp;order=group_id"><?php 
        _e('Date Created', 'bp-group-management');
        ?>
</a></th>
            		<th scope="col"><a href="admin.php?page=bp-group-management&amp;order=popular"><?php 
        _e('Number of Members', 'bp-group-management');
        ?>
</a></th>

            		<?php 
        do_action('bp_gm_group_column_header');
        ?>
            	</tr>
            </thead>

			<tbody id="the-list">
            	<?php 
        while (bp_groups()) {
            bp_the_group();
            ?>
   					<?php 
            $group = $groups_template->group;
            ?>
            		<tr>
            			<th scope="row" class="check-column">

						</th>

						<th scope="row"  class="bp-gm-group-id">
							<?php 
            bp_group_id();
            ?>
						</th>


						<td scope="row" class="bp-gm-avatar">
  							 <a href="admin.php?page=bp-group-management&action=edit&id=<?php 
            bp_group_id();
            ?>
" class="edit"><?php 
            bp_group_avatar('width=35&height=35');
            ?>
</a>
 						</td>

						<td scope="row">
							<?php 
            bp_group_name();
            ?>
									<br/>
									<?php 
            $controlActions = array();
            $controlActions[] = '<a href="admin.php?page=bp-group-management&amp;action=edit&amp;id=' . bp_get_group_id() . '" class="edit">' . __('Members', 'bp-group-management') . '</a>';
            $controlActions[] = '<a class="delete" href="admin.php?page=bp-group-management&amp;action=delete&amp;id=' . bp_get_group_id() . '">' . __("Delete") . '</a>';
            $controlActions[] = '<a href="' . bp_get_group_permalink() . 'admin">' . __('Admin', 'bp-group-management') . '</a>';
            $controlActions[] = "<a href='" . bp_get_group_permalink() . "' rel='permalink'>" . __('Visit', 'bp-group-management') . '</a>';
            $controlActions = apply_filters('bp_gm_group_action_links', $controlActions);
            ?>

									<?php 
            if (count($controlActions)) {
                ?>
									<div class="row-actions">
										<?php 
                echo implode(' | ', $controlActions);
                ?>
									</div>
									<?php 
            }
            ?>


						</td>

						<td scope="row">
							<?php 
            bp_group_type();
            ?>
						</td>

						<td scope="row">
							<?php 
            echo $group->date_created;
            ?>
						</td>

						<td scope="row">
							<?php 
            bp_group_total_members();
            ?>
						</td>

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


            		</tr>
            	<?php 
        }
        ?>

            </tbody>
         	</table>

         	<div class="tablenav">
    			<div class="tablenav-pages">

					<span class="displaying-num" id="group-dir-count">
						<?php 
        bp_groups_pagination_count();
        ?>
					</span>

					<span class="page-numbers" id="group-dir-pag">
						<?php 
        bp_group_management_pagination_links();
        ?>
					</span>

				</div>
			</div>

            	<?php 
    } else {
        ?>
            	You don't have any groups to manage.

            	<?php 
    }
    ?>

        <a class="button" id="bp-gm-settings-link" href="admin.php?page=bp-group-management&action=settings"><?php 
    _e('Plugin settings', 'bp-group-management');
    ?>
</a>
        </div>

<?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 
    }
Example #12
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;
    }
Example #13
0
function invite_anyone_screen_one_content()
{
    global $bp;
    if (!($iaoptions = get_option('invite_anyone'))) {
        $iaoptions = array();
    }
    if (!($max_invites = $iaoptions['max_invites'])) {
        $max_invites = 5;
    }
    $from_group = false;
    if (!empty($bp->action_variables)) {
        if ('group-invites' == $bp->action_variables[0]) {
            $from_group = $bp->action_variables[1];
        }
    }
    /* This handles the email addresses sent back when there is an error */
    $returned_emails = array();
    $counter = 0;
    if (isset($_GET['email0'])) {
        while ($_GET['email' . $counter]) {
            $returned_emails[] = trim(urldecode($_GET['email' . $counter]));
            $counter++;
        }
    }
    $returned_groups = array(0);
    /* If the user is coming from the widget, $returned_emails is populated with those email addresses */
    if (isset($_POST['invite_anyone_widget'])) {
        check_admin_referer('invite-anyone-widget_' . $bp->loggedin_user->id);
        if (is_array($_POST['emails'])) {
            foreach ($_POST['emails'] as $email) {
                if (trim($email) != '' && trim($email) != __('email address', 'bp-invite-anyone')) {
                    $returned_emails[] = trim($email);
                }
            }
        }
        /* If the widget appeared on a group page, the group ID should come along with it too */
        if (isset($_POST['invite_anyone_widget_group'])) {
            $returned_groups[] = $_POST['invite_anyone_widget_group'];
        }
    }
    /* $returned_groups is padded so that array_search (below) returns true for first group */
    $counter = 0;
    if (isset($_GET['group0'])) {
        while ($_GET['group' . $counter]) {
            $returned_groups[] = urldecode($_GET['group' . $counter]);
            $counter++;
        }
    }
    if (isset($_GET['subject'])) {
        $returned_subject = stripslashes(urldecode($_GET['subject']));
    } else {
        $returned_subject = '';
    }
    if (isset($_GET['message'])) {
        $returned_message = stripslashes(urldecode($_GET['message']));
    } else {
        $returned_message = '';
    }
    $blogname = get_bloginfo('name');
    $welcome_message = sprintf(__('Invite friends to join %s by following these steps:', 'bp-invite-anyone'), $blogname);
    ?>
	<form id="invite-anyone-by-email" action="<?php 
    echo $bp->displayed_user->domain . $bp->invite_anyone->slug . '/sent-invites/send/';
    ?>
" method="post">

	<h4><?php 
    _e('Invite New Members', 'bp-invite-anyone');
    ?>
</h4>
	<p id="welcome-message"><?php 
    echo $welcome_message;
    ?>
</p>

	<ol id="invite-anyone-steps">
		
		<li>
			<p><?php 
    _e('Enter email addresses in the fields below.', 'bp-invite-anyone');
    ?>
 <?php 
    if (invite_anyone_allowed_domains()) {
        ?>
 <?php 
        _e('You can only invite people whose email addresses end in one of the following domains:', 'bp-invite-anyone');
        ?>
 <?php 
        echo invite_anyone_allowed_domains();
    }
    ?>
</p>
		
			<?php 
    invite_anyone_email_fields($returned_emails);
    ?>
		</li>

		<li>
			<?php 
    if ($iaoptions['subject_is_customizable'] == 'yes') {
        ?>
				<label for="invite-anyone-custom-subject"><?php 
        _e('(optional) Customize the subject line of the invitation email.', 'bp-invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" ><?php 
        echo invite_anyone_invitation_subject($returned_subject);
        ?>
</textarea>
			<?php 
    } else {
        ?>
				<label for="invite-anyone-custom-subject"><?php 
        _e('Subject: <span class="disabled-subject">Subject line is fixed</span>', 'bp-invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" disabled="disabled"><?php 
        echo invite_anyone_invitation_subject($returned_subject);
        ?>
 </textarea>
				
				<input type="hidden" id="invite-anyone-customised-subject" name="invite_anyone_custom_subject" value="<?php 
        echo invite_anyone_invitation_subject();
        ?>
" />
			<?php 
    }
    ?>
		</li>

		<li>
			<?php 
    if ($iaoptions['message_is_customizable'] == 'yes') {
        ?>
				<label for="invite-anyone-custom-message"><?php 
        _e('(optional) Customize the text of the invitation.', 'bp-invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" cols="40" rows="10"><?php 
        echo invite_anyone_invitation_message($returned_message);
        ?>
</textarea>
			<?php 
    } else {
        ?>
				<label for="invite-anyone-custom-message"><?php 
        _e('Message:', 'bp-invite-anyone');
        ?>
</label>
					<textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" disabled="disabled"><?php 
        echo invite_anyone_invitation_message($returned_message);
        ?>
</textarea>
				
				<input type="hidden" name="invite_anyone_custom_message" value="<?php 
        echo invite_anyone_invitation_message();
        ?>
" />
			<?php 
    }
    ?>
				<p><?php 
    _e('The message will also contain a custom footer containing links to accept the invitation or opt out of further email invitations from this site.', 'bp-invite-anyone');
    ?>
</p>

		</li>

		<?php 
    if (invite_anyone_are_groups_running()) {
        ?>
			<?php 
        if ($iaoptions['can_send_group_invites_email'] == 'yes' && bp_has_groups("per_page=10000&type=alphabetical&user_id=" . bp_loggedin_user_id())) {
            ?>
			<li>
				<p><?php 
            _e('(optional) Select some groups. Invitees will receive invitations to these groups when they join the site.', 'bp-invite-anyone');
            ?>
</p>
				<ul id="invite-anyone-group-list">
					<?php 
            while (bp_groups()) {
                bp_the_group();
                ?>
						<li>
						<input type="checkbox" name="invite_anyone_groups[]" id="invite_anyone_groups-<?php 
                bp_group_id();
                ?>
" value="<?php 
                bp_group_id();
                ?>
" <?php 
                if ($from_group == bp_get_group_id() || array_search(bp_get_group_id(), $returned_groups)) {
                    ?>
checked<?php 
                }
                ?>
 />
						
						<label for="invite_anyone_groups-<?php 
                bp_group_id();
                ?>
" class="invite-anyone-group-name"><?php 
                bp_group_avatar_mini();
                ?>
 <span><?php 
                bp_group_name();
                ?>
</span></label>

						</li>
					<?php 
            }
            ?>

				</ul>
       
			</li>
			<?php 
        }
        ?>

		<?php 
    }
    ?>

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

	</ol>

	<div class="submit">
		<input type="submit" name="invite-anyone-submit" id="invite-anyone-submit" value="<?php 
    _e('Send Invites', 'buddypress');
    ?>
 " />
	</div>


	</form>
	<?php 
}
Example #14
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>
/**
 * 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 
    }
}
Example #16
0
						<label><?php _e( 'Content:', 'buddypress' ) ?></label>
						<textarea name="topic_text" id="topic_text"></textarea>

						<label><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
						<input type="text" name="topic_tags" id="topic_tags" value="" />

						<label><?php _e( 'Post In Group Forum:', 'buddypress' ) ?></label>
						<select id="topic_group_id" name="topic_group_id">

							<option value="">----</option>

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

								<?php if ( bp_group_is_forum_enabled() && 'public' == bp_get_group_status() ) : ?>

									<option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>

								<?php endif; ?>

							<?php endwhile; ?>

						</select><!-- #topic_group_id -->

						<?php do_action( 'groups_forum_new_topic_after' ) ?>

						<div class="submit">
							<input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ) ?>" />
							<input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php _e( 'Cancel', 'buddypress' ) ?>" />
						</div>

						<?php wp_nonce_field( 'bp_forums_new_topic' ) ?>
Example #17
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' ); ?>
Example #18
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 
    }
Example #19
0
<?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: ?>