コード例 #1
1
 function getGroups($force = false)
 {
     //need a user id for this
     if (empty($this->ID)) {
         return false;
     }
     //check cache
     if (isset($this->groups) && !$force) {
         return $this->groups;
     }
     //remove the bp-site-groups filter
     remove_filter('groups_get_groups', 'bpsg_groups_get_groups');
     //get corresponding class ids for buddypress groups this user is a member of
     $groups = array();
     if (bp_has_groups(array('user_id' => $this->ID))) {
         while (bp_groups()) {
             bp_the_group();
             $group_id = bp_get_group_id();
             $groups[] = groups_get_group(array('group_id' => $group_id));
         }
     }
     //add the bp-site-groups filter back
     add_filter('groups_get_groups', 'bpsg_groups_get_groups');
     $this->groups = $groups;
     return $this->groups;
 }
コード例 #2
1
ファイル: bp-groups-widgets.php プロジェクト: n-sane/zaroka
	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
	}
コード例 #3
0
ファイル: function.php プロジェクト: morganloehr/chris-verna
    function training_wpo_buddypress_group_header()
    {
        global $groups_template;
        ?>
	<div id="item-header" class="pb-group pb-item-header" role="complementary">
		<div class="container">
				<?php 
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                ?>
				<?php 
                bp_get_template_part('groups/single/group-header');
                ?>
			<?php 
            }
        }
        ?>
		</div>
	</div><!-- #item-header -->


<?php 
    }
コード例 #4
0
ファイル: post-form.php プロジェクト: kosir/thatcamp-org
					<?php 
    _e('Post in', 'buddypress');
    ?>
:

					<select id="whats-new-post-in" name="whats-new-post-in">
						<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 
        }
    }
    ?>
コード例 #5
0
/**
 *  members sidebar header widget
 *
 * @package Custom Community
 * @since 1.8.3
 */
function profiles_header_widget($args)
{
    extract($args);
    $options = get_option("profiles_header_position");
    if (!is_array($options)) {
        $options = array('profiles_header_position' => 'horizontal');
    }
    if ($options[profiles_header_position] != 'horizontal') {
        locate_template(array('members/single/member-header-sidebar.php'), true, false);
    } else {
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                locate_template(array('members/single/member-header.php'), true, false);
            }
        }
    }
}
コード例 #6
0
ファイル: widgets.php プロジェクト: tamriel-foundry/apoc2
 function get_group()
 {
     // Setup args
     $args = array('type' => 'active', 'max' => 5, 'populate_extras' => false);
     // Retrieve groups
     if (bp_has_groups($args)) {
         // Re-shuffle the array to draw a random group
         global $groups_template;
         shuffle($groups_template->groups);
         // Only load the first group
         bp_the_group();
         // Build the HTML
         $this->html = $this->build_html();
     }
 }
コード例 #7
0
 /**
  * Create the hub overview CSV when requested.
  *
  * @since    1.0.0
  */
 public function run_stat_hub_csv()
 {
     global $wpdb;
     $bp = buddypress();
     // Output headers so that the file is downloaded rather than displayed.
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=cc-hubs-overview.csv');
     // Create a file pointer connected to the output stream.
     $output = fopen('php://output', 'w');
     // Write a header row.
     $row = array('Hub ID', 'Name', 'Slug', 'Status', 'Date Created', 'Last Activity', 'Parent Hub ID', 'Total Members', 'Creator ID', 'Creator Email', 'Forum', 'BP Docs', 'CC Hub Home Page', 'CC Hub Pages', 'CC Hub Narratives', 'Custom Plugins');
     fputcsv($output, $row);
     // Groups Loop
     if (bp_has_groups(array('order' => 'ASC', 'orderby' => 'date_created', 'page' => null, 'per_page' => null, 'max' => false, 'show_hidden' => true, 'user_id' => null, 'meta_query' => false, 'include' => false, 'exclude' => false, 'populate_extras' => false, 'update_meta_cache' => false))) {
         while (bp_groups()) {
             bp_the_group();
             $group_id = bp_get_group_id();
             $group_object = groups_get_group(array('group_id' => (int) $group_id, 'populate_extras' => true));
             // Hub ID
             $row = array($group_id);
             // Name
             $row[] = bp_get_group_name();
             // Slug
             $row[] = bp_get_group_slug();
             // Status
             $row[] = bp_get_group_status();
             // Date Created
             $row[] = $group_object->date_created;
             // Date of last activity
             $row[] = $group_object->last_activity;
             // Parent Hub ID
             $row[] = $wpdb->get_var($wpdb->prepare("SELECT g.parent_id FROM {$bp->groups->table_name} g WHERE g.id = %d", $group_id));
             // Total Members
             $row[] = groups_get_total_member_count($group_id);
             // Creator ID
             $creator_id = $group_object->creator_id;
             $row[] = $creator_id;
             // Creator Email
             $creator = get_user_by('id', $creator_id);
             $row[] = $creator->user_email;
             // Forum
             $row[] = $group_object->enable_forum;
             // BP Docs
             if (function_exists('bp_docs_is_docs_enabled_for_group')) {
                 $row[] = bp_docs_is_docs_enabled_for_group($group_id);
             } else {
                 $row[] = '';
             }
             // CC Hub Home Page
             if (function_exists('cc_get_group_home_page_post') && cc_get_group_home_page_post($group_id)->have_posts()) {
                 $row[] = 1;
             } else {
                 $row[] = 0;
             }
             // CC Hub Pages
             $row[] = (bool) groups_get_groupmeta($group_id, "ccgp_is_enabled");
             // CC Hub Narratives
             $row[] = (bool) groups_get_groupmeta($group_id, "ccgn_is_enabled");
             // Custom Plugins
             // To make your group-specific plugin be counted, so something like this:
             /*	add_filter( 'cc_stats_custom_plugins', 'prefix_report_custom_plugin', 10, 2 );
              *	function prefix_report_custom_plugin( $custom_plugins, $group_id ) {
              *		if ( $group_id == sa_get_group_id() ) {
              *			$custom_plugins[] = "CC Salud America";
              *		}
              *		return $custom_plugins;
              *	}
              */
             $custom_plugins = apply_filters('cc_stats_custom_plugins', array(), $group_id);
             $custom_plugins = implode(' ', $custom_plugins);
             $row[] = $custom_plugins;
             // Write the row.
             fputcsv($output, $row);
         }
     }
     fclose($output);
     exit;
 }
コード例 #8
0
/**
 * Prints the box content.
 * 
 * @param WP_Post $post The object for the current post/page.
 */
function bpgroups_meta_box_callback($post)
{
    // Add an nonce field so we can check for it later.
    wp_nonce_field('bpgroups_meta_box', 'bpgroups_meta_box_nonce');
    // to store the groups this user is member of
    $buddypressgroups = array();
    $checkgroups = array();
    // Get real Buddypress Groups
    if (function_exists('bp_groups')) {
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                $groupname = bp_get_group_name();
                $groupslug = bp_get_group_slug();
                // Set group as taxonomy term if not already done
                $termexists = term_exists($groupname, 'buddypress_groups');
                if (empty($termexists)) {
                    wp_insert_term($groupname, 'buddypress_groups', array('slug' => strtolower($groupname)));
                }
                // Get only groups the current user is member of
                if (groups_is_user_member(get_current_user_id(), bp_get_group_id())) {
                    $buddypressgroups[] = array('name' => $groupname, 'slug' => $groupslug);
                    $checkgroups[] = strtolower($groupslug);
                }
            }
        }
    }
    // Remove tax terms that have no buddypress group counterpart anymore in case of changes
    $allgroupterms = get_terms('buddypress_groups', array('hide_empty' => false));
    foreach ($allgroupterms as $groupterm) {
        if (!in_array($groupterm->slug, $checkgroups) && $groupterm->slug != 'keine') {
            // just keep non assignment term
            $term = get_term_by('slug', $groupterm->name, 'buddypress_groups');
            if ($term) {
                wp_delete_term($term->term_id, 'buddypress_groups');
            }
        }
    }
    //get the group assigned to this post if any
    $assignedgroups = wp_get_object_terms(array($post->ID), array('buddypress_groups'));
    $assignedgroup = 'keine';
    // posts without assignments
    if ($assignedgroups) {
        $assignedgroup = $assignedgroups[0]->slug;
        // technically more than one but we use only one
    }
    ?>
	<p>
		<select name="bpgroups_groupselector" id="bpgroups_groupselector" size="1">
			<option value="keine" <?php 
    selected($assignedgroup, 'keine', true);
    ?>
>Keine</option>
			<?php 
    foreach ($buddypressgroups as $bpgroup) {
        $name = $bpgroup['name'];
        $slug = $bpgroup['slug'];
        ?>
				<option value="<?php 
        echo esc_html($slug);
        ?>
" <?php 
        selected($assignedgroup, $slug, true);
        ?>
><?php 
        echo esc_html($name);
        ?>
</option>
	<?php 
    }
    ?>
		</select>
	</p>
	<?php 
}
コード例 #9
0
ファイル: post-form.php プロジェクト: n-sane/zaroka
		</div>

		<div id="whats-new-options">
			<div id="whats-new-submit">
				<span class="ajax-loader"></span> &nbsp;
				<input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php _e( 'Post Update', 'buddypress' ) ?>" />
			</div>

			<?php if ( function_exists('bp_has_groups') && !bp_is_my_profile() && !bp_is_group() ) : ?>
				<div id="whats-new-post-in-box">
					<?php _e( 'Post in', 'buddypress' ) ?>:

					<select id="whats-new-post-in" name="whats-new-post-in">
						<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 endwhile; endif; ?>
					</select>
				</div>
				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
			<?php elseif ( bp_is_group_home() ) : ?>
				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
				<input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id() ?>" />
			<?php endif; ?>

			<?php do_action( 'bp_activity_post_form_options' ) ?>

		</div><!-- #whats-new-options -->
	</div><!-- #whats-new-content -->
コード例 #10
0
ファイル: extension.php プロジェクト: adisonc/MaineLearning
    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;
    }
コード例 #11
0
 /**
  *
  * @global type $wpdp
  * @global type $bp
  * @param type $num
  * @param type $featured
  * @return type
  * @version 1.2.2
  * v1.2.1, 17/9/2013, stergatu fix the http://wordpress.org/support/topic/widget-functionality bug
  * v1, 1/5/2013
  * @author stergatu
  * @since 0.5
  */
 public static function get_list_for_usergroups_widget($num, $featured = 0)
 {
     global $wpdb, $bp;
     if (bp_has_groups('user_id=' . get_current_user_id())) {
         while (bp_groups()) {
             bp_the_group();
             $group_array[] = bp_get_group_id();
         }
     }
     $sql = "SELECT * FROM " . BP_GROUP_DOCUMENTS_TABLE . " WHERE group_id in (" . implode(',', array_map('absint', $group_array)) . " ) ";
     if ($featured && BP_GROUP_DOCUMENTS_FEATURED) {
         $sql .= "AND featured = 1 ";
     }
     $sql .= "ORDER BY created_ts DESC LIMIT %d";
     $result = $wpdb->get_results($wpdb->prepare($sql, $num), ARRAY_A);
     return $result;
 }
 function render_field($field)
 {
     /*
      *  Review the data of $field.
      *  This will show what data is available
      */
     // echo '<pre>';
     // 	print_r( $field );
     // echo '</pre>';
     /*
      *  Create a simple text input using the 'font_size' setting.
      */
     /*
     ?>
     <input type="text" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" style="font-size:<?php echo $field['font_size'] ?>px;" />
     <?php
     */
     // defaults?
     $field = array_merge($this->defaults, $field);
     // Change Field into a select
     $field['type'] = 'select';
     $field['choices'] = array();
     // set the user ID if you want to return only groups that this user is a member of.
     $user_id = $field['groups'] == 1 ? FALSE : get_current_user_id();
     $args = array('per_page' => 999, 'user_id' => $user_id);
     if (bp_has_groups($args)) {
         while (bp_groups()) {
             bp_the_group();
             $field['choices'][bp_get_group_id()] = bp_get_group_name();
         }
     }
     // create field
     do_action('acf/render_field/type=select', $field);
 }
コード例 #13
0
 protected function generate_html($template_type = '')
 {
     $group_ids = array();
     foreach ($this->search_results['items'] as $item_id => $item_html) {
         $group_ids[] = $item_id;
     }
     //now we have all the posts
     //lets do a groups loop
     $args = array('include' => $group_ids, 'per_page' => count($group_ids));
     if (is_user_logged_in()) {
         $args['show_hidden'] = true;
     }
     if (bp_has_groups($args)) {
         while (bp_groups()) {
             bp_the_group();
             $result = array('id' => bp_get_group_id(), 'type' => $this->type, 'title' => bp_get_group_name(), 'html' => buddyboss_global_search_buffer_template_part('loop/group', $template_type, false));
             $this->search_results['items'][bp_get_group_id()] = $result;
         }
         //var_dump( $this->search_results['items'] );
     }
 }
コード例 #14
0
ファイル: by-email.php プロジェクト: hnla/invite-anyone
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 
}
コード例 #15
0
function bp_groupblog_update_defaults()
{
    // retrieve the old landing page slug so we know which pages to delete
    $oldoptions = get_site_option('bp_groupblog_blog_defaults_options');
    // create an array to hold the chosen options
    $newoptions = array();
    $newoptions['theme'] = $_POST['theme'];
    // groupblog validation settings
    $newoptions['allowdashes'] = !empty($_POST['bp_groupblog_allowdashes']) ? 1 : 0;
    $newoptions['allowunderscores'] = !empty($_POST['bp_groupblog_allowunderscores']) ? 1 : 0;
    $newoptions['allownumeric'] = !empty($_POST['bp_groupblog_allownumeric']) ? 1 : 0;
    $newoptions['minlength'] = isset($_POST['bp_groupblog_minlength']) && is_numeric($_POST['bp_groupblog_minlength']) == true ? $_POST['bp_groupblog_minlength'] : 4;
    // groupblog default settings
    $newoptions['default_cat_name'] = isset($_POST['default_cat_name']) ? $_POST['default_cat_name'] : '';
    $newoptions['default_link_cat'] = isset($_POST['default_link_cat']) ? $_POST['default_link_cat'] : '';
    if (!empty($_POST['delete_first_post'])) {
        $newoptions['delete_first_post'] = 1;
    } else {
        $newoptions['delete_first_post'] = 0;
    }
    if (!empty($_POST['delete_first_comment'])) {
        $newoptions['delete_first_comment'] = 1;
    } else {
        $newoptions['delete_first_comment'] = 0;
    }
    if (!empty($_POST['delete_blogroll_links'])) {
        $newoptions['delete_blogroll_links'] = 1;
    } else {
        $newoptions['delete_blogroll_links'] = 0;
    }
    // groupblog layout settings
    if (!empty($_POST['group_admin_layout'])) {
        $newoptions['group_admin_layout'] = 1;
    } else {
        $newoptions['group_admin_layout'] = 0;
    }
    // redirect group home to blog home
    if (!empty($_POST['deep_group_integration'])) {
        $newoptions['deep_group_integration'] = 1;
    } else {
        $newoptions['deep_group_integration'] = 0;
    }
    // groupblog redirect option
    $newoptions['redirectblog'] = isset($_POST['bp_groupblog_redirect_blog']) ? $_POST['bp_groupblog_redirect_blog'] : '';
    $newoptions['pagetitle'] = isset($_POST['bp_groupblog_page_title']) ? $_POST['bp_groupblog_page_title'] : __('Blog', 'bp-groupblog');
    $newoptions['pageslug'] = isset($_POST['bp_groupblog_page_title']) ? sanitize_title($_POST['bp_groupblog_page_title']) : '';
    $newoptions['page_template_layout'] = isset($_POST['page_template_layout']) ? $_POST['page_template_layout'] : 'magazine';
    $newoptions['rerun'] = 0;
    if ($newoptions['redirectblog'] == 2) {
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                if ($blog_id = get_groupblog_blog_id(bp_get_group_id())) {
                    switch_to_blog($blog_id);
                    $change_front = new WP_Query('pagename=' . $newoptions['pageslug']);
                    if ($change_front->have_posts()) {
                        while ($change_front->have_posts()) {
                            $change_front->the_post();
                            $blog_page_id = get_the_ID();
                        }
                    }
                    if ($newoptions['deep_group_integration'] == 1) {
                        $page_or_posts = 'page';
                        update_option('page_on_front', $blog_page_id);
                    } else {
                        $page_or_posts = 'posts';
                    }
                    update_option('show_on_front', $page_or_posts);
                }
            }
        }
        update_site_option('bp_groupblog_blog_defaults_options', $newoptions);
        $get_out = false;
        if ($newoptions['redirectblog'] != 2) {
            $get_out = true;
        }
        if ($oldoptions['pageslug'] == $newoptions['pageslug'] && $oldoptions['redirectblog'] == 2) {
            $get_out = true;
        }
        if ($get_out && $oldoptions['rerun'] == 0) {
            return false;
        }
        echo '<div id="message" class="updated fade">';
        echo '<p><strong>The following blogs were updated</strong></p>';
        $exists_in = array();
        $updated_blogs = array();
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                if ($blog_id = get_groupblog_blog_id(bp_get_group_id())) {
                    switch_to_blog($blog_id);
                    $create = new WP_Query('pagename=' . $newoptions['pageslug']);
                    if ($create->have_posts()) {
                        $get_lost = 1;
                        while ($create->have_posts()) {
                            $create->the_post();
                            if (!get_post_meta(get_the_ID(), 'created_by_groupblog_dont_change')) {
                                $exists_in[] = get_bloginfo('name');
                                $page_found = 1;
                                $newoptions['rerun'] = 1;
                            }
                        }
                    } else {
                        if (!$get_lost) {
                            $blog_page = array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_status' => 'publish', 'post_name' => $newoptions['pageslug'], 'post_title' => $newoptions['pagetitle'], 'post_type' => 'page', 'post_content' => __('<p><strong>This page has been created automatically by the BuddyPress GroupBlog plugin.</strong></p><p>Please contact the site admin if you see this message instead of your blog posts. Possible solution: please advise your site admin to create the <a href="http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates">page template</a> needed for the BuddyPress GroupBlog plugin.<p>', 'groupblog'));
                            $blog_page_id = wp_insert_post($blog_page);
                            if ($blog_page_id) {
                                add_post_meta($blog_page_id, '_wp_page_template', 'blog.php');
                                // add a special meta key so if we have to clean it up later we know the difference between pages
                                // created by us and ones created by the user so we don't delete their pages.
                                add_post_meta($blog_page_id, 'created_by_groupblog_dont_change', '1');
                                $updated_blogs[] = get_bloginfo('name');
                            }
                        }
                        // find the page created previously and delete it, checking first to see if it was one we created or not
                        if ($oldoptions['pageslug'] != $newoptions['pageslug']) {
                            $cleanup = new WP_Query('pagename=' . $oldoptions['pageslug']);
                            if ($cleanup->have_posts()) {
                                while ($cleanup->have_posts()) {
                                    $cleanup->the_post();
                                    if (get_post_meta(get_the_ID(), 'created_by_groupblog_dont_change')) {
                                        wp_delete_post(get_the_ID(), $force_delete = true);
                                    }
                                }
                            }
                            //cleanup
                        }
                    }
                }
                $get_lost = 0;
            }
        }
        foreach ($updated_blogs as $blog) {
            echo '<p>- ' . $blog . '</p>';
        }
        if ($page_found) {
            echo '<div class="error">';
            echo '<p style="line-height: 16px;"><strong>We skipped the following blogs</strong></p>';
            foreach ($exists_in as $blog) {
                echo '<p>- ' . $blog . '</p>';
            }
            echo '<p><em>These blogs already had a page named <strong>"' . $newoptions["pagetitle"] . '"</strong> which was not created by us. Please check and delete that page permanently after which you should return here and click save once more to finalize the process. Alternatively you can choose another template page name.</em></p></div>';
        }
        echo '</div>';
    } elseif ($newoptions['redirectblog'] != 2) {
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                if ($blog_id = get_groupblog_blog_id(bp_get_group_id())) {
                    switch_to_blog($blog_id);
                    update_option('show_on_front', 'posts');
                }
            }
        }
    }
    // override the site option
    update_site_option('bp_groupblog_blog_defaults_options', $newoptions);
    $options = get_site_option('bp_groupblog_blog_defaults_options');
}
コード例 #16
0
    function on_bp_gtm_admin_groups($bp_gtm)
    {
        global $bp;
        ?>
        <table id="bp-gtm-admin-table" class="widefat link-group">
            <thead>
                <tr class="header">
                    <td colspan="2"><?php 
        _e('Which groups should have GTM System turned on?', 'bp_gtm');
        ?>
</td>
                    <td class="own_roles"><?php 
        _e('Own roles?', 'bp_gtm');
        ?>
</td>
                </tr>
            </thead>
            <tbody id="the-list">
                <tr>
                    <td><input type="checkbox" class="bp_gtm_allgroups" name="bp_gtm_allgroups" <?php 
        echo 'all' == $bp_gtm['groups'] ? 'checked="checked" ' : '';
        ?>
 value="all" /></td>
                    <td><?php 
        _e('All groups', 'bp_gtm');
        ?>
</td>
                    <td class="own_roles">&nbsp;</td>
                </tr>
                <?php 
        $arg['type'] = 'alphabetical';
        $arg['per_page'] = '1000';
        if (bp_has_groups($arg)) {
            while (bp_groups()) {
                bp_the_group();
                $description = preg_replace(array('<<p>>', '<</p>>', '<<br />>', '<<br>>'), '', bp_get_group_description_excerpt());
                echo '<tr>
                                <td><input name="bp_gtm_groups[' . bp_get_group_id() . ']" class="bp_gtm_groups" type="checkbox" ' . ('all' == $bp_gtm['groups'] || $bp_gtm['groups'][bp_get_group_id()] == 'on' ? 'checked="checked" ' : '') . 'value="on" /></td>
                                <td><a href="' . bp_get_group_permalink() . $bp->gtm->slug . '/" target="_blank">' . bp_get_group_name() . '</a> &rarr; ' . $description . '</td>
                                <td class="own_roles"><input name="bp_gtm_groups_own_roles[' . bp_get_group_id() . ']" class="bp_gtm_groups_own_roles" type="checkbox" ' . ((!empty($bp_gtm['groups_own_roles']) || !empty($bp_gtm['groups_own_roles'][bp_get_group_id()])) && 'all' == $bp_gtm['groups_own_roles'] || !empty($bp_gtm['groups_own_roles'][bp_get_group_id()]) && $bp_gtm['groups_own_roles'][bp_get_group_id()] == bp_get_group_id() ? 'checked="checked" ' : '') . 'value="' . bp_get_group_id() . '" /></td>
                            </tr>';
            }
        }
        ?>
            </tbody>
            <tfoot>
                <tr class="header">
                    <td><input type="checkbox" class="bp_gtm_allgroups" name="bp_gtm_allgroups" <?php 
        echo 'all' == $bp_gtm['groups'] ? 'checked="checked" ' : '';
        ?>
 value="all" /></td>
                    <td><?php 
        _e('All groups', 'bp_gtm');
        ?>
</td>
                    <td>&nbsp;</td>
                </tr>
            </tfoot>
        </table>
        <?php 
    }
 function create_field($field)
 {
     // defaults?
     $field = array_merge($this->defaults, $field);
     // Change Field into a select
     $field['type'] = 'select';
     $field['choices'] = array();
     // set the user ID if you want to return only groups that this user is a member of.
     $user_id = $field['groups'] == 1 ? FALSE : get_current_user_id();
     $args = array('per_page' => 999, 'user_id' => $user_id);
     if (bp_has_groups($args)) {
         while (bp_groups()) {
             bp_the_group();
             $field['choices'][bp_get_group_id()] = bp_get_group_name();
         }
     }
     // create field
     do_action('acf/create_field', $field);
 }
コード例 #18
0
    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 
    }
コード例 #19
0
/**
 * 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 
    }
}
コード例 #20
0
ファイル: library.php プロジェクト: poweronio/mbsite
    /**
     * BP Groups Grid
     */
    function bp_groups_grid($atts)
    {
        $default_columns = 3;
        //four columns
        $allowed_columns = array(2, 3, 4, 6);
        extract(shortcode_atts(array('type' => 'active', 'max_item' => 10, 'columns' => $default_columns), $atts));
        $columns = floor(12 / $columns);
        // ensure that columns is scalable
        if (!in_array($columns, $allowed_columns)) {
            // default to default columns settings, just in case
            $columns = $default_columns;
        }
        $columns_classes = 'col-md-' . $columns . ' col-sm-' . $columns . ' col-xs-6';
        $params = array('type' => $type, 'per_page' => $max_item);
        $output = '';
        if (function_exists('bp_has_groups')) {
            if (bp_has_groups($params)) {
                ob_start();
                ?>
 
					<ul class="clearfix gears-bp-groups-grid">
						<?php 
                while (bp_groups()) {
                    ?>
						<?php 
                    bp_the_group();
                    ?>
							<li class="bp-groups-grid-item <?php 
                    echo $columns_classes;
                    ?>
">
								<?php 
                    $name = bp_get_group_name();
                    ?>
								<?php 
                    $permalink = bp_get_group_permalink();
                    ?>
								<?php 
                    $last_active = bp_get_group_last_active();
                    ?>
								<?php 
                    $members_count = bp_get_group_member_count();
                    ?>
								<?php 
                    $modal_content = esc_attr($members_count . ' &middot; ' . __('Active ', 'gears') . $last_active . '');
                    ?>
								
								<a title="<?php 
                    echo esc_attr($name);
                    ?>
" href="<?php 
                    echo esc_url($permalink);
                    ?>
">
									<span class="groups-name">
										<?php 
                    echo esc_attr($name);
                    ?>
											<span class="groups-count">
												<?php 
                    echo intval($members_count);
                    ?>
												<?php 
                    if ($members_count == 1) {
                        ?>
													<?php 
                        _e('Member', 'gears');
                        ?>
												<?php 
                    } else {
                        ?>
													<?php 
                        _e('Members', 'gears');
                        ?>
												<?php 
                    }
                    ?>
											</span>
									</span>

								</a>

								<a title="<?php 
                    echo esc_attr($name);
                    ?>
" href="<?php 
                    echo esc_url($permalink);
                    ?>
">
									<?php 
                    echo bp_get_group_avatar(array('type' => 'full'));
                    ?>
								</a>
							</li>
						<?php 
                }
                ?>
					</ul>
				<?php 
                $output = ob_get_clean();
                return $output;
            } else {
                return '<div class="alert alert-info">' . __('There are no groups to display. Please try again soon.', 'gears') . '</div>';
            }
        } else {
            return $this->bp_not_installed;
        }
    }
コード例 #21
0
    /**
     * 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 
    }
コード例 #22
0
ファイル: group-invites.php プロジェクト: hnla/invite-anyone
function invite_anyone_create_screen_content($event)
{
    if (function_exists('bp_post_get_permalink')) {
        // ugly ugly ugly hack to check for pre-1.2 versions of BP
        add_action('wp_footer', 'invite_anyone_add_old_css');
        ?>

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

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

				<?php 
                if ($event != 'create') {
                    ?>
					<form action="<?php 
                    bp_group_send_invite_form_action();
                    ?>
" method="post" id="send-invite-form">
				<?php 
                }
                ?>

					<div class="left-menu">

						<p><?php 
                _e("Search for members to invite:", 'bp-invite-anyone');
                ?>
 &nbsp; <span class="ajax-loader"></span></p>

						<ul class="first acfb-holder">
							<li>
								<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
							</li>
						</ul>

						<p><?php 
                _e('Select members from the directory:', 'bp-invite-anyone');
                ?>
 <span class="ajax-loader"></span></p>

						<div id="invite-anyone-member-list">
							<ul>
								<?php 
                bp_new_group_invite_member_list();
                ?>
							</ul>

							<?php 
                wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user');
                ?>
						</div>

					</div>

					<div class="main-column">

						<div id="message" class="info">
							<p><?php 
                _e('Select people to invite.', 'bp-invite-anyone');
                ?>
</p>
						</div>

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

						<?php 
                /* The ID 'friend-list' is important for AJAX support. */
                ?>
						<ul id="invite-anyone-invite-list" class="item-list">
						<?php 
                if (bp_group_has_invites()) {
                    ?>

							<?php 
                    while (bp_group_invites()) {
                        bp_group_the_invite();
                        ?>

								<li id="<?php 
                        bp_group_invite_item_id();
                        ?>
">
									<?php 
                        bp_group_invite_user_avatar();
                        ?>

									<h4><?php 
                        bp_group_invite_user_link();
                        ?>
</h4>
									<span class="activity"><?php 
                        bp_group_invite_user_last_active();
                        ?>
</span>

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

									<div class="action">
										<a class="remove" href="<?php 
                        bp_group_invite_user_remove_invite_url();
                        ?>
" id="<?php 
                        bp_group_invite_item_id();
                        ?>
"><?php 
                        _e('Remove Invite', 'buddypress');
                        ?>
</a>

										<?php 
                        do_action('bp_group_send_invites_item_action');
                        ?>
									</div>
								</li>

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

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

					</div>

					<div class="clear"></div>

				<?php 
                if ($event != 'create') {
                    ?>
					<p class="clear"><input type="submit" name="submit" id="submit" value="<?php 
                    _e('Send Invites', 'buddypress');
                    ?>
" /></p>
					<?php 
                    wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
                    ?>
				<?php 
                }
                ?>



					<input type="hidden" name="group_id" id="group_id" value="<?php 
                bp_group_id();
                ?>
" />
				<?php 
                if ($event != 'create') {
                    ?>
					</form>
				<?php 
                }
                ?>


			<?php 
                do_action('bp_before_group_send_invites_content');
                ?>
	<?php 
            }
        }
    } else {
        // Begin BP 1.2 code
        ?>
	<?php 
        do_action('bp_before_group_send_invites_content');
        ?>

	<?php 
        if (invite_anyone_access_test() && !bp_is_group_create()) {
            ?>
		<p><?php 
            _e('Want to invite someone to the group who is not yet a member of the site?', 'bp-invite-anyone');
            ?>
 <a href="<?php 
            echo bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . '/invite-new-members/group-invites/' . bp_get_group_id();
            ?>
"><?php 
            _e('Send invitations by email.', 'bp-invite-anyone');
            ?>
</a></p>
	<?php 
        }
        ?>

	<?php 
        if ($event != 'create') {
            ?>
			<form action="send" method="post" id="send-invite-form">
	<?php 
        }
        ?>



		<div class="left-menu">
					<p><?php 
        _e("Search for members to invite:", 'bp-invite-anyone');
        ?>
 &nbsp; <span class="ajax-loader"></span></p>

					<ul class="first acfb-holder">
						<li>
							<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
						</li>
					</ul>

					<p><?php 
        _e('Select members from the directory:', 'bp-invite-anyone');
        ?>
 <span class="ajax-loader"></span></p>

					<div id="invite-anyone-member-list">
						<ul>
							<?php 
        bp_new_group_invite_member_list();
        ?>
						</ul>

						<?php 
        wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user');
        ?>
					</div>



		</div>

		<div class="main-column">

			<div id="message" class="info">
				<p><?php 
        _e('Select people to invite from your friends list.', 'buddypress');
        ?>
</p>
			</div>

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

			<?php 
        /* The ID 'friend-list' is important for AJAX support. */
        ?>
			<ul id="invite-anyone-invite-list" class="item-list">
			<?php 
        if (bp_group_has_invites()) {
            ?>

				<?php 
            while (bp_group_invites()) {
                bp_group_the_invite();
                ?>

					<li id="<?php 
                bp_group_invite_item_id();
                ?>
">
						<?php 
                bp_group_invite_user_avatar();
                ?>

						<h4><?php 
                bp_group_invite_user_link();
                ?>
</h4>
						<span class="activity"><?php 
                bp_group_invite_user_last_active();
                ?>
</span>

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

						<div class="action">
							<a class="remove" href="<?php 
                bp_group_invite_user_remove_invite_url();
                ?>
" id="<?php 
                bp_group_invite_item_id();
                ?>
"><?php 
                _e('Remove Invite', 'buddypress');
                ?>
</a>

							<?php 
                do_action('bp_group_send_invites_item_action');
                ?>
						</div>
					</li>

				<?php 
            }
            ?>

			<?php 
        }
        ?>
			</ul>

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

		</div>

		<div class="clear"></div>

		<?php 
        if ($event != 'create') {
            ?>
		<div class="submit">
			<input type="submit" name="submit" id="submit" value="<?php 
            _e('Send Invites', 'buddypress');
            ?>
" />
		</div>
		<?php 
        }
        ?>

		<?php 
        wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
        ?>

		<!-- Don't leave out this sweet field -->
			<?php 
        if (!bp_get_new_group_id()) {
            ?>
<input type="hidden" name="group_id" id="group_id" value="<?php 
            bp_group_id();
            ?>
" /><?php 
        } else {
            ?>
<input type="hidden" name="group_id" id="group_id" value="<?php 
            bp_new_group_id();
            ?>
" /><?php 
        }
        ?>

	<?php 
        if ($event != 'create') {
            ?>





		</form>
	<?php 
        }
        ?>

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



	<?php 
    }
}
コード例 #23
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 
}
コード例 #24
0
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 
}
コード例 #25
0
ファイル: index.php プロジェクト: n-sane/zaroka
						<label><?php _e( 'Title:', 'buddypress' ) ?></label>
						<input type="text" name="topic_title" id="topic_title" value="" />

						<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' ) ?>" />
コード例 #26
0
 /**
  * @group BP6319
  */
 public function test_private_group_where_loggedin_user_has_requested_membership()
 {
     $u = $this->factory->user->create();
     $g = $this->factory->group->create(array('status' => 'private'));
     $this->set_current_user($u);
     groups_send_membership_request($u, $g);
     if (bp_has_groups(array('include' => array($g)))) {
         while (bp_groups()) {
             bp_the_group();
             $found = get_echo('bp_group_status_message');
         }
     }
     $expected = __('This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress');
     $this->assertSame($expected, $found);
 }
コード例 #27
0
 /**
  * Set up items for display in the list table.
  *
  * Handles filtering of data, sorting, pagination, and any other data
  * manipulation required prior to rendering.
  *
  * @since 1.7.0
  */
 public function prepare_items()
 {
     global $groups_template;
     $screen = get_current_screen();
     // Option defaults
     $include_id = false;
     $search_terms = false;
     // Set current page
     $page = $this->get_pagenum();
     // Set per page from the screen options
     $per_page = $this->get_items_per_page(str_replace('-', '_', "{$screen->id}_per_page"));
     // Sort order.
     $order = 'DESC';
     if (!empty($_REQUEST['order'])) {
         $order = 'desc' == strtolower($_REQUEST['order']) ? 'DESC' : 'ASC';
     }
     // Order by - default to newest
     $orderby = 'last_activity';
     if (!empty($_REQUEST['orderby'])) {
         switch ($_REQUEST['orderby']) {
             case 'name':
                 $orderby = 'name';
                 break;
             case 'id':
                 $orderby = 'date_created';
                 break;
             case 'members':
                 $orderby = 'total_member_count';
                 break;
             case 'last_active':
                 $orderby = 'last_activity';
                 break;
         }
     }
     // Are we doing a search?
     if (!empty($_REQUEST['s'])) {
         $search_terms = $_REQUEST['s'];
     }
     // Check if user has clicked on a specific group (if so, fetch only that group).
     if (!empty($_REQUEST['gid'])) {
         $include_id = (int) $_REQUEST['gid'];
     }
     // Set the current view
     if (isset($_GET['group_status']) && in_array($_GET['group_status'], array('public', 'private', 'hidden'))) {
         $this->view = $_GET['group_status'];
     }
     // We'll use the ids of group types for the 'include' param
     $this->group_type_ids = BP_Groups_Group::get_group_type_ids();
     // Pass a dummy array if there are no groups of this type
     $include = false;
     if ('all' != $this->view && isset($this->group_type_ids[$this->view])) {
         $include = !empty($this->group_type_ids[$this->view]) ? $this->group_type_ids[$this->view] : array(0);
     }
     // Get group type counts for display in the filter tabs
     $this->group_counts = array();
     foreach ($this->group_type_ids as $group_type => $group_ids) {
         $this->group_counts[$group_type] = count($group_ids);
     }
     // If we're viewing a specific group, flatten all activities into a single array.
     if ($include_id) {
         $groups = array((array) groups_get_group('group_id=' . $include_id));
     } else {
         $groups_args = array('include' => $include, 'per_page' => $per_page, 'page' => $page, 'orderby' => $orderby, 'order' => $order);
         $groups = array();
         if (bp_has_groups($groups_args)) {
             while (bp_groups()) {
                 bp_the_group();
                 $groups[] = (array) $groups_template->group;
             }
         }
     }
     // Set raw data to display
     $this->items = $groups;
     // Store information needed for handling table pagination
     $this->set_pagination_args(array('per_page' => $per_page, 'total_items' => $groups_template->total_group_count, 'total_pages' => ceil($groups_template->total_group_count / $per_page)));
 }
コード例 #28
0
/**
 * GMW FL function - get list of groups in checkboxes or dropdown
 */
function gmw_fl_get_bp_groups($gmw, $usage, $groups, $name)
{
    if (!bp_is_active('groups')) {
        return;
    }
    $output = '';
    if ($usage == 'checkbox') {
        $output .= '<span class="search-all">' . $gmw['labels']['search_form']['select_groups'] . '</span>';
        $output .= '<ul id="gmw-' . $gmw['ID'] . '-' . $name . '-checkboxes-wrapper" class="gmw-' . $name . '-checkboxes-wrapper gmw-' . $gmw['prefix'] . '-' . $name . '-checkboxes-wrapper">';
    } else {
        $output .= '<label for="gmw-bp-groups-' . $usage . '-' . $gmw['ID'] . '">' . $gmw['labels']['search_form']['select_groups'] . '</label>';
        $output .= '<select name="' . $name . '" id="gmw-bp-groups-dropdown-' . $gmw['ID'] . '" class="gmw-bp-groups-dropdown gmw-' . $gmw['prefix'] . '-bp-groups-dropdown">';
        $output .= '<option value="">' . $gmw['labels']['search_form']['no_groups'] . '</option>';
        $output .= '<option value="' . implode(',', $groups) . '">' . $gmw['labels']['search_form']['all_groups'] . '</option>';
    }
    if (bp_has_groups()) {
        while (bp_groups()) {
            bp_the_group();
            $gid = bp_get_group_id();
            if (!in_array($gid, $groups)) {
                continue;
            }
            $gname = bp_get_group_name();
            if ($usage == 'checkbox') {
                $output .= '<li id="gmw-' . $gmw['ID'] . '-' . $name . '-' . $gid . '-checkbox-wrapper" class="gmw-' . $name . '-checkbox-wrapper gmw-' . $gmw['prefix'] . '-' . $name . '-checkbox-wrapper">';
                $output .= '<input type="checkbox" id="gmw-' . $gmw['ID'] . '-' . $name . '-' . $gid . '-checkbox" value="' . $gid . '" name=' . $name . '[]" />';
                $output .= '<label for="gmw-' . $gmw['ID'] . '-' . $name . '-' . $gid . '-checkbox">' . $gname . '</label>';
                $output .= '</li>';
            } else {
                $output .= '<option value="' . $gid . '">' . $gname . '</option>';
            }
        }
    }
    if ($usage == 'checkbox') {
        $output .= '<ul>';
    } else {
        $output .= '</select>';
    }
    return apply_filters('gmw_fl_get_bp_groups', $output, $gmw, $usage, $groups, $name);
}
コード例 #29
0
ファイル: groups-widget.php プロジェクト: kosir/thatcamp-org
    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 
    }
コード例 #30
0
ファイル: index.php プロジェクト: r-chopra17/p2bp
<?php get_header() ?>

	<div id="content">
		<div class="padder">
			<?php if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); ?>

			<?php do_action( 'bp_before_group_home_content' ) ?>

			<div id="item-header">
				<?php locate_template( array( 'groups/single/group-header.php' ), true ) ?>
			</div>

			<div id="item-nav">
				<div class="item-list-tabs no-ajax" id="sub-nav">
					<ul>
						<?php bp_get_options_nav() ?>

						<?php do_action( 'bp_group_options_nav' ) ?>
					</ul>
				</div>
			</div>

			<div id="item-body">
				<?php do_action( 'template_notices' ) ?>

				<?php do_action( 'bp_before_group_body' ) ?>
	<?php if(bp_is_gallery_home())
			 locate_template( array( 'gallery/groups/home.php' ), true ) ;
			 
		else if(bp_is_gallery_create())
			locate_template( array( 'gallery/groups/create.php' ), true ) ;