当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_the_group函数代码示例

本文整理汇总了PHP中bp_the_group函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_the_group函数的具体用法?PHP bp_the_group怎么用?PHP bp_the_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_the_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget

	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
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:47,代码来源:bp-groups-widgets.php

示例2: getGroups

 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;
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:26,代码来源:class.SPStudent.php

示例3: training_wpo_buddypress_group_header

    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 
    }
开发者ID:morganloehr,项目名称:chris-verna,代码行数:24,代码来源:function.php

示例4: _e

					<?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 
        }
    }
    ?>
开发者ID:kosir,项目名称:thatcamp-org,代码行数:29,代码来源:post-form.php

示例5: profiles_header_widget

/**
 *  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);
            }
        }
    }
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:24,代码来源:widgets.php

示例6: get_group

 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();
     }
 }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:15,代码来源:widgets.php

示例7: run_stat_hub_csv

 /**
  * 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;
 }
开发者ID:careshub,项目名称:cc-stats,代码行数:83,代码来源:class-cc-stats-admin.php

示例8: bpgroups_meta_box_callback

/**
 * 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 
}
开发者ID:acrylian,项目名称:buddypress_group_taxonomy,代码行数:80,代码来源:buddypress-group-taxonomy.php

示例9: _e

		</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 -->
开发者ID:n-sane,项目名称:zaroka,代码行数:30,代码来源:post-form.php

示例10: display

    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();
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:extension.php

示例11: get_list_for_usergroups_widget

 /**
  *
  * @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;
 }
开发者ID:lilarock3rs,项目名称:bp-group-documents,代码行数:30,代码来源:classes.php

示例12: render_field

 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);
 }
开发者ID:rabidgadfly,项目名称:acf-field-buddypress-groups,代码行数:34,代码来源:acf-buddypress_groups-v5.php

示例13: generate_html

 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'] );
     }
 }
开发者ID:tvolmari,项目名称:hammydowns,代码行数:21,代码来源:class.BBoss_Global_Search_Groups.php

示例14: invite_anyone_screen_one_content


//.........这里部分代码省略.........
    } 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 
}
开发者ID:hnla,项目名称:invite-anyone,代码行数:101,代码来源:by-email.php

示例15: bp_groupblog_update_defaults

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;
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:bp-groupblog-admin.php


注:本文中的bp_the_group函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。