當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BP_Groups_Member::delete_all方法代碼示例

本文整理匯總了PHP中BP_Groups_Member::delete_all方法的典型用法代碼示例。如果您正苦於以下問題:PHP BP_Groups_Member::delete_all方法的具體用法?PHP BP_Groups_Member::delete_all怎麽用?PHP BP_Groups_Member::delete_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BP_Groups_Member的用法示例。


在下文中一共展示了BP_Groups_Member::delete_all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete

 /**
  * Delete the current group.
  *
  * @return bool True on success, false on failure.
  */
 public function delete()
 {
     global $wpdb;
     // Delete groupmeta for the group.
     groups_delete_groupmeta($this->id);
     // Fetch the user IDs of all the members of the group.
     $user_ids = BP_Groups_Member::get_group_member_ids($this->id);
     $user_id_str = esc_sql(implode(',', wp_parse_id_list($user_ids)));
     // Modify group count usermeta for members.
     $wpdb->query("UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_id_str} )");
     // Now delete all group member entries.
     BP_Groups_Member::delete_all($this->id);
     /**
      * Fires before the deletion of a group.
      *
      * @since 1.2.0
      *
      * @param BP_Groups_Group $this     Current instance of the group item being deleted. Passed by reference.
      * @param array           $user_ids Array of user IDs that were members of the group.
      */
     do_action_ref_array('bp_groups_delete_group', array(&$this, $user_ids));
     wp_cache_delete($this->id, 'bp_groups');
     $bp = buddypress();
     // 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:swissspidy,項目名稱:BuddyPress,代碼行數:34,代碼來源:class-bp-groups-group.php

示例2: delete

 function delete()
 {
     global $wpdb, $bp;
     // Delete groupmeta for the group
     groups_delete_groupmeta($this->id);
     // Fetch the user IDs of all the members of the group
     $user_ids = BP_Groups_Member::get_group_member_ids($this->id);
     $user_id_str = implode(',', (array) $user_ids);
     // Modify group count usermeta for members
     $wpdb->query("UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_id_str} )");
     // Now delete all group member entries
     BP_Groups_Member::delete_all($this->id);
     do_action_ref_array('bp_groups_delete_group', array(&$this, $user_ids));
     wp_cache_delete('bp_groups_group_' . $this->id, 'bp');
     // 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:adisonc,項目名稱:MaineLearning,代碼行數:20,代碼來源:bp-groups-classes.php

示例3: delete

	function delete() {
		global $wpdb, $bp;

		/* Delete groupmeta for the group */
		groups_delete_groupmeta( $this->id );

		/* Fetch the user IDs of all the members of the group */
		$user_ids = BP_Groups_Member::get_group_member_ids( $this->id );
		$user_ids = implode( ',', (array)$user_ids );

		/* Modify group count usermeta for members */
		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )" ) );

		/* Now delete all group member entries */
		BP_Groups_Member::delete_all( $this->id );

		do_action( 'bp_groups_delete_group', $this );

		// 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:n-sane,項目名稱:zaroka,代碼行數:24,代碼來源:bp-groups-classes.php


注:本文中的BP_Groups_Member::delete_all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。