本文整理汇总了PHP中bp_blogs_delete_blogmeta函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_blogs_delete_blogmeta函数的具体用法?PHP bp_blogs_delete_blogmeta怎么用?PHP bp_blogs_delete_blogmeta使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_blogs_delete_blogmeta函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_blog_for_all
function delete_blog_for_all($blog_id)
{
global $wpdb, $bp;
if (!$bp->blogs) {
bp_blogs_setup_globals();
}
bp_blogs_delete_blogmeta($blog_id);
return $wpdb->query($wpdb->prepare("DELETE FROM {$bp->blogs->table_name} WHERE blog_id = %d", $blog_id));
}
示例2: bp_blogs_update_blogmeta
function bp_blogs_update_blogmeta($blog_id, $meta_key, $meta_value)
{
global $wpdb, $bp;
if (!is_numeric($blog_id)) {
return false;
}
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
if (is_string($meta_value)) {
$meta_value = stripslashes($wpdb->escape($meta_value));
}
$meta_value = maybe_serialize($meta_value);
if (empty($meta_value)) {
return bp_blogs_delete_blogmeta($blog_id, $meta_key);
}
$cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key));
if (!$cur) {
$wpdb->query($wpdb->prepare("INSERT INTO {$bp->blogs->table_name_blogmeta} ( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value));
} else {
if ($cur->meta_value != $meta_value) {
$wpdb->query($wpdb->prepare("UPDATE {$bp->blogs->table_name_blogmeta} SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key));
} else {
return false;
}
}
wp_cache_set('bp_blogs_blogmeta_' . $blog_id . '_' . $meta_key, $meta_value, 'bp');
return true;
}
示例3: delete_blog_for_all
/**
* Delete the record of a given blog for all users.
*
* @param int $blog_id The blog being removed from all users.
* @return int|bool Number of rows deleted on success, false on failure.
*/
public static function delete_blog_for_all($blog_id)
{
global $wpdb;
bp_blogs_delete_blogmeta($blog_id);
$bp = buddypress();
return $wpdb->query($wpdb->prepare("DELETE FROM {$bp->blogs->table_name} WHERE blog_id = %d", $blog_id));
}
示例4: test_bp_blogs_delete_blogmeta_with_delete_all
/**
* @group blogmeta
* @group bp_blogs_delete_blogmeta
*/
public function test_bp_blogs_delete_blogmeta_with_delete_all()
{
// With no meta key, don't delete for all items - just delete
// all for a single item
bp_blogs_add_blogmeta(1, 'foo', 'bar');
bp_blogs_add_blogmeta(1, 'foo1', 'bar1');
bp_blogs_add_blogmeta(2, 'foo', 'bar');
bp_blogs_add_blogmeta(2, 'foo1', 'bar1');
$this->assertTrue(bp_blogs_delete_blogmeta(1, 'foo', '', true));
$this->assertSame('', bp_blogs_get_blogmeta(1, 'foo'));
$this->assertSame('', bp_blogs_get_blogmeta(2, 'foo'));
$this->assertSame('bar1', bp_blogs_get_blogmeta(1, 'foo1'));
$this->assertSame('bar1', bp_blogs_get_blogmeta(2, 'foo1'));
}
示例5: bp_blogs_delete_url_blogmeta
/**
* Deletes the 'url' blogmeta for a site.
*
* Hooked to 'refresh_blog_details', which is notably used when editing a site
* under "Network Admin > Sites".
*
* @since BuddyPress (2.3.0)
*
* @param int $site_id The site ID.
*/
function bp_blogs_delete_url_blogmeta($site_id = 0)
{
bp_blogs_delete_blogmeta((int) $site_id, 'url');
}
示例6: delete_blog_for_all
function delete_blog_for_all($blog_id)
{
global $nxtdb, $bp;
bp_blogs_delete_blogmeta($blog_id);
return $nxtdb->query($nxtdb->prepare("DELETE FROM {$bp->blogs->table_name} WHERE blog_id = %d", $blog_id));
}