本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}