本文整理匯總了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;
}