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


PHP groups_get_total_member_count函数代码示例

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


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

示例1: groups_screen_group_members

/**
 * Handle the display of a group's Members page.
 */
function groups_screen_group_members()
{
    if (!bp_is_single_item()) {
        return false;
    }
    $bp = buddypress();
    // Refresh the group member count meta.
    groups_update_groupmeta($bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count($bp->groups->current_group->id));
    /**
     * Fires before the loading of a group's Members page.
     *
     * @since 1.0.0
     *
     * @param int $id ID of the group whose members are being displayed.
     */
    do_action('groups_screen_group_members', $bp->groups->current_group->id);
    /**
     * Filters the template to load for a group's Members page.
     *
     * @since 1.0.0
     *
     * @param string $value Path to a group's Members template.
     */
    bp_core_load_template(apply_filters('groups_template_group_members', 'groups/single/home'));
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:28,代码来源:bp-groups-screens.php

示例2: delete_all_for_user

 /**
  * Delete all group membership information for the specified user
  *
  * @global object $bp BuddyPress global settings
  * @global wpdb $wpdb WordPress database object
  * @param int $user_id
  * @since 1.0
  * @uses BP_Groups_Member
  */
 function delete_all_for_user($user_id)
 {
     global $bp, $wpdb;
     // Get all the group ids for the current user's groups and update counts
     $group_ids = BP_Groups_Member::get_group_ids($user_id);
     foreach ($group_ids['groups'] as $group_id) {
         groups_update_groupmeta($group_id, 'total_member_count', groups_get_total_member_count($group_id) - 1);
         // If current user is the creator of a group and is the sole admin, delete that group to avoid counts going out-of-sync
         if (groups_is_user_admin($user_id, $group_id) && count(groups_get_group_admins($group_id)) < 2 && groups_is_user_creator($user_id, $group_id)) {
             groups_delete_group($group_id);
         }
     }
     return $wpdb->query($wpdb->prepare("DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d", $user_id));
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:23,代码来源:bp-groups-classes.php

示例3: groups_screen_group_members

/**
 * Handle the display of a group's Members page.
 */
function groups_screen_group_members()
{
    if (!bp_is_single_item()) {
        return false;
    }
    $bp = buddypress();
    // Refresh the group member count meta
    groups_update_groupmeta($bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count($bp->groups->current_group->id));
    do_action('groups_screen_group_members', $bp->groups->current_group->id);
    bp_core_load_template(apply_filters('groups_template_group_members', 'groups/single/home'));
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:14,代码来源:bp-groups-screens.php

示例4: 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

示例5: groups_screen_group_members

function groups_screen_group_members()
{
    global $bp;
    if ($bp->is_single_item) {
        // Refresh the group member count meta
        groups_update_groupmeta($bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count($bp->groups->current_group->id));
        do_action('groups_screen_group_members', $bp->groups->current_group->id);
        bp_core_load_template(apply_filters('groups_template_group_members', 'groups/single/home'));
    }
}
开发者ID:newington,项目名称:buddypress,代码行数:10,代码来源:bp-groups-screens.php

示例6: test_groups_leave_group_multiple_admins_allow_leave

 /**
  * @group groups_leave_group
  * @group group_membership
  */
 public function test_groups_leave_group_multiple_admins_allow_leave()
 {
     $old_current_user = get_current_user_id();
     $u1 = $this->factory->user->create();
     $g = $this->factory->group->create(array('creator_id' => $u1));
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $m2 = new BP_Groups_Member($u2, $g);
     $m2->promote('admin');
     $before = groups_get_total_member_count($g);
     $this->set_current_user($u1);
     groups_leave_group($g, $u1);
     $after = groups_get_total_member_count($g);
     $this->assertEquals($before - 1, $after);
     $this->set_current_user($old_current_user);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:20,代码来源:class-bp-groups-member.php

示例7: wangguard_spam_all_data

function wangguard_spam_all_data($user_id)
{
    global $wpdb, $bp;
    $wpdb->query($wpdb->prepare("DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id));
    friends_remove_data($user_id);
    $group_ids = BP_Groups_Member::get_group_ids($user_id);
    foreach ($group_ids['groups'] as $group_id) {
        groups_update_groupmeta($group_id, 'total_member_count', groups_get_total_member_count($group_id) - 1);
        // If current user is the creator of a group and is the sole admin, delete that group to avoid counts going out-of-sync
        if (groups_is_user_admin($user_id, $group_id) && count(groups_get_group_admins($group_id)) < 2 && groups_is_user_creator($user_id, $group_id)) {
            groups_delete_group($group_id);
        }
    }
    return $wpdb->query($wpdb->prepare("DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d", $user_id));
    BP_Groups_Member::delete_all_for_user($user_id);
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:16,代码来源:wangguard-buddypress.php


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