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


PHP BP_Groups_Member::check_is_member方法代码示例

本文整理汇总了PHP中BP_Groups_Member::check_is_member方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::check_is_member方法的具体用法?PHP BP_Groups_Member::check_is_member怎么用?PHP BP_Groups_Member::check_is_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Groups_Member的用法示例。


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

示例1: populate

 function populate()
 {
     global $nxtdb, $bp;
     if ($group = $nxtdb->get_row($nxtdb->prepare("SELECT g.*, gm.meta_value as last_activity, gm2.meta_value as total_member_count FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name_groupmeta} gm2 WHERE g.id = gm.group_id AND g.id = gm2.group_id AND gm.meta_key = 'last_activity' AND gm2.meta_key = 'total_member_count' AND g.id = %d", $this->id))) {
         $this->id = $group->id;
         $this->creator_id = $group->creator_id;
         $this->name = stripslashes($group->name);
         $this->slug = $group->slug;
         $this->description = stripslashes($group->description);
         $this->status = $group->status;
         $this->enable_forum = $group->enable_forum;
         $this->date_created = $group->date_created;
         $this->last_activity = $group->last_activity;
         $this->total_member_count = $group->total_member_count;
         $this->is_member = BP_Groups_Member::check_is_member($bp->loggedin_user->id, $this->id);
         // Get group admins and mods
         $admin_mods = $nxtdb->get_results(apply_filters('bp_group_admin_mods_user_join_filter', $nxtdb->prepare("SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$nxtdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id)));
         foreach ((array) $admin_mods as $user) {
             if ((int) $user->is_admin) {
                 $this->admins[] = $user;
             } else {
                 $this->mods[] = $user;
             }
         }
     }
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:26,代码来源:bp-groups-classes.php

示例2: populate

 function populate()
 {
     global $wpdb, $bp;
     if ($group = $wpdb->get_row($wpdb->prepare("SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $this->id))) {
         bp_groups_update_meta_cache($this->id);
         $this->id = $group->id;
         $this->creator_id = $group->creator_id;
         $this->name = stripslashes($group->name);
         $this->slug = $group->slug;
         $this->description = stripslashes($group->description);
         $this->status = $group->status;
         $this->enable_forum = $group->enable_forum;
         $this->date_created = $group->date_created;
         $this->last_activity = groups_get_groupmeta($this->id, 'last_activity');
         $this->total_member_count = groups_get_groupmeta($this->id, 'total_member_count');
         $this->is_member = BP_Groups_Member::check_is_member(bp_loggedin_user_id(), $this->id);
         // If this is a private or hidden group, does the current user have access?
         if ('private' == $this->status || 'hidden' == $this->status) {
             if ($this->is_member && is_user_logged_in() || bp_current_user_can('bp_moderate')) {
                 $this->user_has_access = true;
             } else {
                 $this->user_has_access = false;
             }
         } else {
             $this->user_has_access = true;
         }
         // Get group admins and mods
         $admin_mods = $wpdb->get_results(apply_filters('bp_group_admin_mods_user_join_filter', $wpdb->prepare("SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id)));
         foreach ((array) $admin_mods as $user) {
             if ((int) $user->is_admin) {
                 $this->admins[] = $user;
             } else {
                 $this->mods[] = $user;
             }
         }
     } else {
         $this->id = 0;
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:39,代码来源:bp-groups-classes.php

示例3: groups_is_user_member

/**
 * Check whether a user is a member of a given group.
 *
 * @param int $user_id ID of the user.
 * @param int $group_id ID of the group.
 *
 * @return bool
 */
function groups_is_user_member($user_id, $group_id)
{
    return BP_Groups_Member::check_is_member($user_id, $group_id);
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:12,代码来源:bp-groups-functions.php

示例4: get_invitable_friend_count

 function get_invitable_friend_count($user_id, $group_id)
 {
     // Setup some data we'll use below
     $is_group_admin = BP_Groups_Member::check_is_admin($user_id, $group_id);
     $friend_ids = BP_Friends_Friendship::get_friend_user_ids($user_id);
     $invitable_count = 0;
     for ($i = 0, $count = count($friend_ids); $i < $count; ++$i) {
         // If already a member, they cannot be invited again
         if (BP_Groups_Member::check_is_member((int) $friend_ids[$i], $group_id)) {
             continue;
         }
         // If user already has invite, they cannot be added
         if (BP_Groups_Member::check_has_invite((int) $friend_ids[$i], $group_id)) {
             continue;
         }
         // If user is not group admin and friend is banned, they cannot be invited
         if (false === $is_group_admin && BP_Groups_Member::check_is_banned((int) $friend_ids[$i], $group_id)) {
             continue;
         }
         $invitable_count++;
     }
     return $invitable_count;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:23,代码来源:bp-friends-classes.php

示例5: populate

 /**
  * Set up data about the current group.
  */
 public function populate()
 {
     global $wpdb;
     // Get BuddyPress.
     $bp = buddypress();
     // Check cache for group data.
     $group = wp_cache_get($this->id, 'bp_groups');
     // Cache missed, so query the DB.
     if (false === $group) {
         $group = $wpdb->get_row($wpdb->prepare("SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $this->id));
         wp_cache_set($this->id, $group, 'bp_groups');
     }
     // No group found so set the ID and bail.
     if (empty($group) || is_wp_error($group)) {
         $this->id = 0;
         return;
     }
     // Group found so setup the object variables.
     $this->id = $group->id;
     $this->creator_id = $group->creator_id;
     $this->name = stripslashes($group->name);
     $this->slug = $group->slug;
     $this->description = stripslashes($group->description);
     $this->status = $group->status;
     $this->enable_forum = $group->enable_forum;
     $this->date_created = $group->date_created;
     // Are we getting extra group data?
     if (!empty($this->args['populate_extras'])) {
         /**
          * Filters the SQL prepared statement used to fetch group admins and mods.
          *
          * @since 1.5.0
          *
          * @param string $value SQL select statement used to fetch admins and mods.
          */
         $admin_mods = $wpdb->get_results(apply_filters('bp_group_admin_mods_user_join_filter', $wpdb->prepare("SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id)));
         // Add admins and moderators to their respective arrays.
         foreach ((array) $admin_mods as $user) {
             if (!empty($user->is_admin)) {
                 $this->admins[] = $user;
             } else {
                 $this->mods[] = $user;
             }
         }
         // Set up some specific group vars from meta. Excluded
         // from the bp_groups cache because it's cached independently.
         $this->last_activity = groups_get_groupmeta($this->id, 'last_activity');
         $this->total_member_count = groups_get_groupmeta($this->id, 'total_member_count');
         // Set user-specific data.
         $user_id = bp_loggedin_user_id();
         $this->is_member = BP_Groups_Member::check_is_member($user_id, $this->id);
         $this->is_invited = BP_Groups_Member::check_has_invite($user_id, $this->id);
         $this->is_pending = BP_Groups_Member::check_for_membership_request($user_id, $this->id);
         // If this is a private or hidden group, does the current user have access?
         if ('private' === $this->status || 'hidden' === $this->status) {
             // Assume user does not have access to hidden/private groups.
             $this->user_has_access = false;
             // Group members or community moderators have access.
             if ($this->is_member && is_user_logged_in() || bp_current_user_can('bp_moderate')) {
                 $this->user_has_access = true;
             }
         } else {
             $this->user_has_access = true;
         }
     }
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:69,代码来源:class-bp-groups-group.php

示例6: get_invitable_friend_count

	function get_invitable_friend_count( $user_id, $group_id ) {
		global $wpdb, $bp;

		$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );

		$invitable_count = 0;
		for ( $i = 0; $i < count($friend_ids); $i++ ) {

			if ( BP_Groups_Member::check_is_member( (int)$friend_ids[$i], $group_id ) )
				continue;

			if ( BP_Groups_Member::check_has_invite( (int)$friend_ids[$i], $group_id )  )
				continue;

			$invitable_count++;
		}

		return $invitable_count;
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:19,代码来源:bp-friends-classes.php

示例7: bp_group_join_button

function bp_group_join_button($group = false)
{
    global $bp, $groups_template;
    if (!$group) {
        $group =& $groups_template->group;
    }
    // If they're not logged in or are banned from the group, no join button.
    if (!is_user_logged_in() || groups_is_user_banned($bp->loggedin_user->id, $group->id)) {
        return false;
    }
    echo '<div class="group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">';
    switch ($group->status) {
        case 'public':
            if (BP_Groups_Member::check_is_member($bp->loggedin_user->id, $group->id)) {
                echo '<a class="leave-group" href="' . wp_nonce_url(bp_get_group_permalink($group) . '/leave-group', 'groups_leave_group') . '">' . __('Leave Group', 'buddypress') . '</a>';
            } else {
                echo '<a class="join-group" href="' . wp_nonce_url(bp_get_group_permalink($group) . '/join', 'groups_join_group') . '">' . __('Join Group', 'buddypress') . '</a>';
            }
            break;
        case 'private':
            if (BP_Groups_Member::check_is_member($bp->loggedin_user->id, $group->id)) {
                echo '<a class="leave-group" href="' . wp_nonce_url(bp_get_group_permalink($group) . '/leave-group', 'groups_leave_group') . '">' . __('Leave Group', 'buddypress') . '</a>';
            } else {
                if (!bp_group_has_requested_membership($group)) {
                    echo '<a class="request-membership" href="' . wp_nonce_url(bp_get_group_permalink($group) . '/request-membership', 'groups_request_membership') . '">' . __('Request Membership', 'buddypress') . '</a>';
                } else {
                    echo '<a class="membership-requested" href="' . bp_get_group_permalink($group) . '">' . __('Request Sent', 'buddypress') . '</a>';
                }
            }
            break;
    }
    echo '</div>';
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:33,代码来源:bp-groups-templatetags.php


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