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


PHP BP_Groups_Member::delete方法代码示例

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


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

示例1: delete

 function delete()
 {
     global $wpdb, $bp;
     // Delete groupmeta for the group
     groups_delete_groupmeta($this->id);
     // Modify group count usermeta for members
     for ($i = 0; $i < count($this->user_dataset); $i++) {
         $user = $this->user_dataset[$i];
         $total_count = get_usermeta($user->user_id, 'total_group_count');
         if ($total_count != '') {
             update_usermeta($user->user_id, 'total_group_count', (int) $total_count - 1);
         }
         // Now delete the group member record
         BP_Groups_Member::delete($user->user_id, $this->id, false);
     }
     // Delete the wire posts for this group if the wire is installed
     if (function_exists('bp_wire_install')) {
         BP_Wire_Post::delete_all_for_item($this->id, $bp->groups->table_name_wire);
     }
     // Finally remove the group entry from the DB
     if (!$wpdb->query($wpdb->prepare("DELETE FROM {$bp->groups->table_name} WHERE id = %d", $this->id))) {
         return false;
     }
     return true;
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:25,代码来源:bp-groups-classes.php

示例2: groups_delete_membership_request

function groups_delete_membership_request($membership_id, $user_id = 0, $group_id = 0)
{
    if (!empty($user_id) && !empty($group_id)) {
        $membership = new BP_Groups_Member($user_id, $group_id);
    } else {
        $membership = new BP_Groups_Member(false, false, $membership_id);
    }
    if (!BP_Groups_Member::delete($membership->user_id, $membership->group_id)) {
        return false;
    }
    return $membership;
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:12,代码来源:bp-groups-functions.php

示例3: groups_reject_membership_request

function groups_reject_membership_request($membership_id)
{
    /* Check the nonce first. */
    if (!check_admin_referer('groups_reject_membership_request')) {
        return false;
    }
    $membership = new BP_Groups_Member(false, false, $membership_id);
    if (!BP_Groups_Member::delete($membership->user_id, $membership->group_id)) {
        return false;
    }
    // Send a notification to the user.
    require_once BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php';
    groups_notification_membership_request_completed($membership->user_id, $membership->group_id, false);
    do_action('groups_membership_rejected', $membership->user_id, $membership->group_id);
    return true;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:16,代码来源:bp-groups.php

示例4: groups_delete_membership_request

function groups_delete_membership_request( $membership_id, $user_id = false, $group_id = false ) {
	if ( $user_id && $group_id )
		$membership = new BP_Groups_Member( $user_id, $group_id );
	else
		$membership = new BP_Groups_Member( false, false, $membership_id );

	if ( !BP_Groups_Member::delete( $membership->user_id, $membership->group_id ) )
		return false;

	return $membership;
}
开发者ID:n-sane,项目名称:zaroka,代码行数:11,代码来源:bp-groups.php

示例5: groups_leave_group

/**
 * Remove a user from a group.
 *
 * @since 1.0.0
 *
 * @param int $group_id ID of the group.
 * @param int $user_id  Optional. ID of the user. Defaults to the currently
 *                      logged-in user.
 * @return bool True on success, false on failure.
 */
function groups_leave_group($group_id, $user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Don't let single admins leave the group.
    if (count(groups_get_group_admins($group_id)) < 2) {
        if (groups_is_user_admin($user_id, $group_id)) {
            bp_core_add_message(__('As the only admin, you cannot leave the group.', 'buddypress'), 'error');
            return false;
        }
    }
    if (!BP_Groups_Member::delete($user_id, $group_id)) {
        return false;
    }
    bp_core_add_message(__('You successfully left the group.', 'buddypress'));
    /**
     * Fires after a user leaves a group.
     *
     * @since 1.0.0
     *
     * @param int $group_id ID of the group.
     * @param int $user_id  ID of the user leaving the group.
     */
    do_action('groups_leave_group', $group_id, $user_id);
    return true;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:37,代码来源:bp-groups-functions.php


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